--- gtkfilesel.c 2005-07-01 16:49:27.000000000 +0000 +++ gtkfilesel-pb.c 2005-07-01 16:36:03.000000000 +0000 @@ -2671,33 +2671,36 @@ { gchar *utf8_cwd; CompletionState *new_state; + gint tries = 0; new_state = g_new (CompletionState, 1); utf8_cwd = get_current_dir_utf8 (); -tryagain: - - new_state->reference_dir = NULL; - new_state->completion_dir = NULL; - new_state->active_completion_dir = NULL; - new_state->directory_storage = NULL; - new_state->directory_sent_storage = NULL; - new_state->last_valid_char = 0; - new_state->updated_text = g_new (gchar, MAXPATHLEN); - new_state->updated_text_alloc = MAXPATHLEN; - new_state->the_completion.text = g_new (gchar, MAXPATHLEN); - new_state->the_completion.text_alloc = MAXPATHLEN; - new_state->user_dir_name_buffer = NULL; - new_state->user_directories = NULL; - - new_state->reference_dir = open_dir (utf8_cwd, new_state); - - if (!new_state->reference_dir) - { - /* Directories changing from underneath us, grumble */ - strcpy (utf8_cwd, G_DIR_SEPARATOR_S); - goto tryagain; + while(++tries <= 2) + { + new_state->reference_dir = NULL; + new_state->completion_dir = NULL; + new_state->active_completion_dir = NULL; + new_state->directory_storage = NULL; + new_state->directory_sent_storage = NULL; + new_state->last_valid_char = 0; + new_state->updated_text = g_new (gchar, MAXPATHLEN); + new_state->updated_text_alloc = MAXPATHLEN; + new_state->the_completion.text = g_new (gchar, MAXPATHLEN); + new_state->the_completion.text_alloc = MAXPATHLEN; + new_state->user_dir_name_buffer = NULL; + new_state->user_directories = NULL; + + new_state->reference_dir = open_dir (utf8_cwd, new_state); + + if (!new_state->reference_dir) + { + /* Directories changing from underneath us, grumble */ + strcpy (utf8_cwd, G_DIR_SEPARATOR_S); + continue; + } + break; } g_free (utf8_cwd);