changeset 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
files gui/dialog/fileselect.c
diffstat 1 files changed, 8 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/gui/dialog/fileselect.c	Sun Mar 24 13:08:12 2013 +0000
+++ b/gui/dialog/fileselect.c	Sun Mar 24 14:16:34 2013 +0000
@@ -506,6 +506,12 @@
 static void fs_Destroy( void )
 {
  WidgetDestroy( fsFileSelect, &fsFileSelect );
+
+ g_hash_table_destroy( fsPathTable );
+
+ g_list_foreach(fsTopList_items, (GFunc) g_free, NULL);
+ g_list_free(fsTopList_items);
+ fsTopList_items = NULL;
 }
 
 static GtkWidget * create_FileSelect( void )
@@ -724,13 +730,8 @@
    if ( !dir[0] ) nfree( dir );
   }
 
- if ( fsTopList_items )
- {
-   g_list_foreach(fsTopList_items, (GFunc) g_free, NULL);
-   g_list_free(fsTopList_items);
-   fsTopList_items = NULL;
- }
- if ( fsPathTable ) g_hash_table_destroy( fsPathTable ); fsPathTable=g_hash_table_new_full(g_str_hash, g_str_equal, free, free);
+ fsPathTable = g_hash_table_new_full(g_str_hash, g_str_equal, free, free);
+
  {
   unsigned int  i, c = 1;