comparison gui/dialog/fileselect.c @ 35959:acec130e2ab2

Free list and hash table data on widget destruction. This immediately releases the memory and doesn't wait until next widget construction to free old data then.
author ib
date Sun, 24 Mar 2013 14:16:34 +0000
parents b522bc621d3c
children 13d09ba17e97
comparison
equal deleted inserted replaced
35958:b522bc621d3c 35959:acec130e2ab2
504 } 504 }
505 505
506 static void fs_Destroy( void ) 506 static void fs_Destroy( void )
507 { 507 {
508 WidgetDestroy( fsFileSelect, &fsFileSelect ); 508 WidgetDestroy( fsFileSelect, &fsFileSelect );
509
510 g_hash_table_destroy( fsPathTable );
511
512 g_list_foreach(fsTopList_items, (GFunc) g_free, NULL);
513 g_list_free(fsTopList_items);
514 fsTopList_items = NULL;
509 } 515 }
510 516
511 static GtkWidget * create_FileSelect( void ) 517 static GtkWidget * create_FileSelect( void )
512 { 518 {
513 GtkWidget * vbox4; 519 GtkWidget * vbox4;
722 } while ( strrchr( dir,'/' ) ); 728 } while ( strrchr( dir,'/' ) );
723 729
724 if ( !dir[0] ) nfree( dir ); 730 if ( !dir[0] ) nfree( dir );
725 } 731 }
726 732
727 if ( fsTopList_items ) 733 fsPathTable = g_hash_table_new_full(g_str_hash, g_str_equal, free, free);
728 { 734
729 g_list_foreach(fsTopList_items, (GFunc) g_free, NULL);
730 g_list_free(fsTopList_items);
731 fsTopList_items = NULL;
732 }
733 if ( fsPathTable ) g_hash_table_destroy( fsPathTable ); fsPathTable=g_hash_table_new_full(g_str_hash, g_str_equal, free, free);
734 { 735 {
735 unsigned int i, c = 1; 736 unsigned int i, c = 1;
736 737
737 if ( fsMedium ) 738 if ( fsMedium )
738 { 739 {