[gnumeric] exception list handling fixes



commit cc1831a69fc5c2375ae4a9e6cb3649aca62f7dd0
Author: Andreas J. Guelzow <aguelzow pyrshep ca>
Date:   Thu Mar 25 01:15:49 2010 -0600

    exception list handling fixes
    
    2010-03-25 Andreas J. Guelzow <aguelzow pyrshep ca>
    
    	* dialog-preferences.c (wordlist_pref_remove): fix leak
    	(wordlist_pref_add): ditto
    
    2010-03-25 Andreas J. Guelzow <aguelzow pyrshep ca>
    
    	* src/gnumeric-gconf.c (set_string_list): since go_conf_set_str_list
    	  may trigger cb_watch_string_list that uses string_list_pool, we need
    	  to fix the hash table first.

 ChangeLog                        |    6 ++++++
 src/dialogs/ChangeLog            |    5 +++++
 src/dialogs/dialog-preferences.c |    9 ++++++---
 src/gnumeric-gconf.c             |    2 +-
 4 files changed, 18 insertions(+), 4 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 01d002d..7015d26 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2010-03-25 Andreas J. Guelzow <aguelzow pyrshep ca>
+
+	* src/gnumeric-gconf.c (set_string_list): since go_conf_set_str_list
+	  may trigger cb_watch_string_list that uses string_list_pool, we need
+	  to fix the hash table first. 
+
 2010-03-23  Morten Welinder  <terra gnome org>
 
 	* src/wbc-gtk.c (cb_paned_size_allocate): Improve handling of
diff --git a/src/dialogs/ChangeLog b/src/dialogs/ChangeLog
index d316fbd..10750fb 100644
--- a/src/dialogs/ChangeLog
+++ b/src/dialogs/ChangeLog
@@ -1,5 +1,10 @@
 2010-03-24 Andreas J. Guelzow <aguelzow pyrshep ca>
 
+	* dialog-preferences.c (wordlist_pref_remove): fix leak
+	(wordlist_pref_add): ditto
+
+2010-03-24 Andreas J. Guelzow <aguelzow pyrshep ca>
+
 	* dialog-preferences.c (wordlist_pref_remove): get and set list 
 	  via gnumeric-gconf
 	(wordlist_pref_add): ditto
diff --git a/src/dialogs/dialog-preferences.c b/src/dialogs/dialog-preferences.c
index 20c14a4..b6d8f36 100644
--- a/src/dialogs/dialog-preferences.c
+++ b/src/dialogs/dialog-preferences.c
@@ -469,7 +469,9 @@ wordlist_pref_remove (GtkButton *button, wordlist_conf_setter_t setter) {
 	if (gtk_tree_selection_get_selected (select, &model, &iter)) {
 		char *text;
 		wordlist_conf_getter_t getter = g_object_get_data (G_OBJECT (button), "getter");
-		GSList *l, *list = go_string_slist_copy (getter ());
+		GSList *l, *list = getter ();
+
+		list = go_string_slist_copy (list);
 
 		gtk_tree_model_get (model, &iter,
 				    0, &text,
@@ -479,8 +481,8 @@ wordlist_pref_remove (GtkButton *button, wordlist_conf_setter_t setter) {
 			g_free (l->data);
 			list = g_slist_delete_link (list, l);
 			setter (list);
-		} else 
-			go_slist_free_custom (list, g_free);
+		}
+		go_slist_free_custom (list, g_free);
 		g_free (text);
 	}
 }
@@ -499,6 +501,7 @@ wordlist_pref_add (GtkButton *button, wordlist_conf_setter_t setter)
 			list = go_string_slist_copy (list);
 			list = g_slist_append (list, g_strdup (text));
 			setter (list);
+			go_slist_free_custom (list, g_free);
 		}
 	}
 }
diff --git a/src/gnumeric-gconf.c b/src/gnumeric-gconf.c
index 7458b5d..3c738ae 100644
--- a/src/gnumeric-gconf.c
+++ b/src/gnumeric-gconf.c
@@ -343,8 +343,8 @@ set_string_list (struct cb_watch_string_list *watch, GSList *x)
 
 	MAYBE_DEBUG_SET (watch->key);
 	watch->var = x;
-	go_conf_set_str_list (root, watch->key, x);
 	g_hash_table_replace (string_list_pool, (gpointer)watch->key, x);
+	go_conf_set_str_list (root, watch->key, x);
 	schedule_sync ();
 }
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]