comparison gui/dialog/fileselect.c @ 35967:76d4f38ffdf9

Fix crash with file selector after pressing OK. The crash would occur with the "dot directory" selected and pressing OK when previously either the "directory up" button or OK (to refresh the file list) has been pressed.
author ib
date Wed, 27 Mar 2013 18:56:13 +0000
parents 3ebf8c880e07
children 73a7d9100fe0
comparison
equal deleted inserted replaced
35966:fab37d38b77c 35967:76d4f38ffdf9
370 static void fs_Up_released( GtkButton * button, gpointer user_data ) 370 static void fs_Up_released( GtkButton * button, gpointer user_data )
371 { 371 {
372 gchar *utf8dir; 372 gchar *utf8dir;
373 373
374 chdir( ".." ); 374 chdir( ".." );
375 fsSelectedFile=fsThatDir;
376 CheckDir( fsFNameList ); 375 CheckDir( fsFNameList );
377 utf8dir = get_current_dir_name_utf8(); 376 utf8dir = get_current_dir_name_utf8();
378 gtk_entry_set_text( GTK_ENTRY( fsPathCombo ),utf8dir ); 377 gtk_entry_set_text( GTK_ENTRY( fsPathCombo ),utf8dir );
379 g_free(utf8dir); 378 g_free(utf8dir);
379 fsSelectedFile=fsThatDir;
380 return; 380 return;
381 } 381 }
382 382
383 static void fs_Ok_released( GtkButton * button, gpointer user_data ) 383 static void fs_Ok_released( GtkButton * button, gpointer user_data )
384 { 384 {
389 389
390 if( ( stat( fsSelectedFile,&fs ) == 0 ) && S_ISDIR( fs.st_mode ) ) 390 if( ( stat( fsSelectedFile,&fs ) == 0 ) && S_ISDIR( fs.st_mode ) )
391 { 391 {
392 gchar *utf8dir; 392 gchar *utf8dir;
393 if ( chdir( fsSelectedFile ) != 0 ) return; 393 if ( chdir( fsSelectedFile ) != 0 ) return;
394 fsSelectedFile=fsThatDir;
395 CheckDir( fsFNameList ); 394 CheckDir( fsFNameList );
396 utf8dir = get_current_dir_name_utf8(); 395 utf8dir = get_current_dir_name_utf8();
397 gtk_entry_set_text( GTK_ENTRY( fsPathCombo ),utf8dir ); 396 gtk_entry_set_text( GTK_ENTRY( fsPathCombo ),utf8dir );
398 g_free(utf8dir); 397 g_free(utf8dir);
399 gtk_widget_grab_focus( fsFNameList ); 398 gtk_widget_grab_focus( fsFNameList );
399 fsSelectedFile=fsThatDir;
400 return; 400 return;
401 } 401 }
402 402
403 fsSelectedDirectory=get_current_dir_name(); 403 fsSelectedDirectory=get_current_dir_name();
404 switch ( fsType ) 404 switch ( fsType )