From 09d4af6fff63dd112b8bb42087f14f7018e2f78c Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Tue, 2 Oct 2007 11:54:42 +0000 Subject: ** Fixes bug #469657 2007-10-02 Matthew Barnes ** Fixes bug #469657 * addressbook/importers/evolution-ldif-importer.c: * calendar/gui/comp-editor-factory.c: * composer/e-msg-composer.c: * e-util/e-config-listener.c: * mail/em-composer-prefs.c: * mail/em-folder-tree-model.c: * mail/em-format.c: * mail/em-format-html.c: * mail/em-migrate.c: * mail/em-subscribe-editor.c: * mail/mail-component.c: * mail/mail-send-recv.c: * mail/message-list.c: * mail/importers/elm-importer.c: * plugins/exchange-operations/exchange-folder-size-display.c: * plugins/mono/mono-plugin.c: * shell/e-shell-settings-dialog.c: * tools/killev.c: * widgets/table/e-table-extras.c: * widgets/table/e-table-selection-model.c: Use destroy functions in GHashTables to simplify memory management. svn path=/trunk/; revision=34344 --- mail/em-subscribe-editor.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) (limited to 'mail/em-subscribe-editor.c') diff --git a/mail/em-subscribe-editor.c b/mail/em-subscribe-editor.c index 5945f6d1ad..53f3e0fdca 100644 --- a/mail/em-subscribe-editor.c +++ b/mail/em-subscribe-editor.c @@ -129,7 +129,7 @@ static int sub_queue_fill_level(EMSubscribe *sub, EMSubscribeNode *node); static void sub_selection_changed(GtkTreeSelection *selection, EMSubscribe *sub); static void -sub_node_free(char *key, EMSubscribeNode *node, EMSubscribe *sub) +sub_node_free(EMSubscribeNode *node) { d(printf("sub node free '%s'\n", node->info?node->info->full_name:"")); if (node->path) @@ -153,10 +153,8 @@ sub_unref(EMSubscribe *sub) d(printf("subscribe object finalised\n")); /* we dont have to delete the "subscribe" task list, as it must be empty, otherwise we wouldn't be unreffed (intentional circular reference) */ - if (sub->folders) { - g_hash_table_foreach(sub->folders, (GHFunc)sub_node_free, sub); + if (sub->folders) g_hash_table_destroy(sub->folders); - } l = sub->info_list; while (l) { GSList *n = l->next; @@ -615,7 +613,10 @@ subscribe_set_store(EMSubscribe *sub, CamelStore *store) sub->store = store; camel_object_ref(store); - sub->folders = g_hash_table_new(g_str_hash, g_str_equal); + sub->folders = g_hash_table_new_full ( + g_str_hash, g_str_equal, + (GDestroyNotify) NULL, + (GDestroyNotify) sub_node_free); model = gtk_tree_store_new (3, G_TYPE_BOOLEAN, G_TYPE_STRING, G_TYPE_POINTER); sub->tree = (GtkTreeView *) gtk_tree_view_new_with_model ((GtkTreeModel *) model); @@ -692,11 +693,13 @@ sub_editor_refresh(GtkWidget *w, EMSubscribeEditor *se) gtk_tree_store_clear((GtkTreeStore *)gtk_tree_view_get_model(sub->tree)); e_dlist_init(&sub->pending); - if (sub->folders) { - g_hash_table_foreach(sub->folders, (GHFunc)sub_node_free, sub); + + if (sub->folders) g_hash_table_destroy(sub->folders); - } - sub->folders = g_hash_table_new(g_str_hash, g_str_equal); + sub->folders = g_hash_table_new_full ( + g_str_hash, g_str_equal, + (GDestroyNotify) NULL, + (GDestroyNotify) sub_node_free); l = sub->info_list; sub->info_list = NULL; -- cgit v1.2.3