mirror of
https://github.com/davatorium/rofi.git
synced 2024-11-25 13:55:34 -05:00
Fix crash on wrongly queued ViewState (thx to teto)
This commit is contained in:
parent
95e8268796
commit
ed6cb59b5d
5 changed files with 19 additions and 15 deletions
|
@ -46,16 +46,16 @@ typedef struct
|
||||||
*/
|
*/
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
TB_AUTOHEIGHT = 1 << 0,
|
TB_AUTOHEIGHT = 1 << 0,
|
||||||
TB_AUTOWIDTH = 1 << 1,
|
TB_AUTOWIDTH = 1 << 1,
|
||||||
TB_LEFT = 1 << 16,
|
TB_LEFT = 1 << 16,
|
||||||
TB_RIGHT = 1 << 17,
|
TB_RIGHT = 1 << 17,
|
||||||
TB_CENTER = 1 << 18,
|
TB_CENTER = 1 << 18,
|
||||||
TB_EDITABLE = 1 << 19,
|
TB_EDITABLE = 1 << 19,
|
||||||
TB_MARKUP = 1 << 20,
|
TB_MARKUP = 1 << 20,
|
||||||
TB_WRAP = 1 << 21,
|
TB_WRAP = 1 << 21,
|
||||||
TB_PASSWORD = 1 << 22,
|
TB_PASSWORD = 1 << 22,
|
||||||
TB_INDICATOR = 1 << 23,
|
TB_INDICATOR = 1 << 23,
|
||||||
} TextboxFlags;
|
} TextboxFlags;
|
||||||
/**
|
/**
|
||||||
* Flags indicating current state of the textbox.
|
* Flags indicating current state of the textbox.
|
||||||
|
|
|
@ -198,7 +198,7 @@ static char **read_hosts_file ( char ** retv, unsigned int *length )
|
||||||
// Reading one line per time.
|
// Reading one line per time.
|
||||||
while ( getline ( &buffer, &buffer_length, fd ) > 0 ) {
|
while ( getline ( &buffer, &buffer_length, fd ) > 0 ) {
|
||||||
// Evaluate one line.
|
// Evaluate one line.
|
||||||
unsigned int index = 0, ti = 0;
|
unsigned int index = 0, ti = 0;
|
||||||
char *token = buffer;
|
char *token = buffer;
|
||||||
|
|
||||||
// Tokenize it.
|
// Tokenize it.
|
||||||
|
|
|
@ -194,7 +194,7 @@ static GRegex * create_regex ( const char *input, int case_sensitive )
|
||||||
{
|
{
|
||||||
#define R( s ) g_regex_new ( s, G_REGEX_OPTIMIZE | ( ( case_sensitive ) ? 0 : G_REGEX_CASELESS ), 0, NULL )
|
#define R( s ) g_regex_new ( s, G_REGEX_OPTIMIZE | ( ( case_sensitive ) ? 0 : G_REGEX_CASELESS ), 0, NULL )
|
||||||
GRegex * retv = NULL;
|
GRegex * retv = NULL;
|
||||||
gchar *r;
|
gchar *r;
|
||||||
switch ( config.matching_method )
|
switch ( config.matching_method )
|
||||||
{
|
{
|
||||||
case MM_GLOB:
|
case MM_GLOB:
|
||||||
|
@ -234,7 +234,7 @@ GRegex **tokenize ( const char *input, int case_sensitive )
|
||||||
}
|
}
|
||||||
|
|
||||||
char *saveptr = NULL, *token;
|
char *saveptr = NULL, *token;
|
||||||
GRegex **retv = NULL;
|
GRegex **retv = NULL;
|
||||||
if ( !config.tokenize ) {
|
if ( !config.tokenize ) {
|
||||||
retv = g_malloc0 ( sizeof ( GRegex* ) * 2 );
|
retv = g_malloc0 ( sizeof ( GRegex* ) * 2 );
|
||||||
retv[0] = (GRegex *) create_regex ( input, case_sensitive );
|
retv[0] = (GRegex *) create_regex ( input, case_sensitive );
|
||||||
|
|
|
@ -174,6 +174,10 @@ static void run_switcher ( ModeMode mode )
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Error dialog must have been created.
|
||||||
|
if ( rofi_view_get_active () != NULL ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
curr_switcher = mode;
|
curr_switcher = mode;
|
||||||
RofiViewState * state = rofi_view_create ( modi[mode], config.filter, NULL, MENU_NORMAL, process_result );
|
RofiViewState * state = rofi_view_create ( modi[mode], config.filter, NULL, MENU_NORMAL, process_result );
|
||||||
if ( state ) {
|
if ( state ) {
|
||||||
|
@ -352,7 +356,7 @@ static int add_mode ( const char * token )
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif // WINDOW_MODE
|
#endif // WINDOW_MODE
|
||||||
// SSh dialog
|
// SSh dialog
|
||||||
if ( strcasecmp ( token, "ssh" ) == 0 ) {
|
if ( strcasecmp ( token, "ssh" ) == 0 ) {
|
||||||
modi[num_modi] = &ssh_mode;
|
modi[num_modi] = &ssh_mode;
|
||||||
num_modi++;
|
num_modi++;
|
||||||
|
|
|
@ -284,7 +284,7 @@ RofiViewState * rofi_view_get_active ( void )
|
||||||
void rofi_view_set_active ( RofiViewState *state )
|
void rofi_view_set_active ( RofiViewState *state )
|
||||||
{
|
{
|
||||||
if ( current_active_menu != NULL && state != NULL ) {
|
if ( current_active_menu != NULL && state != NULL ) {
|
||||||
g_queue_push_head ( &( CacheState.views ), state );
|
g_queue_push_head ( &( CacheState.views ), current_active_menu );
|
||||||
// TODO check.
|
// TODO check.
|
||||||
current_active_menu = state;
|
current_active_menu = state;
|
||||||
g_log ( LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "stack view." );
|
g_log ( LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "stack view." );
|
||||||
|
|
Loading…
Reference in a new issue