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-format.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'mail/em-format.c') diff --git a/mail/em-format.c b/mail/em-format.c index f22cc1a577..ce820cab11 100644 --- a/mail/em-format.c +++ b/mail/em-format.c @@ -91,10 +91,8 @@ static guint emf_signals[EMF_LAST_SIGNAL]; static GObjectClass *emf_parent; static void -emf_free_cache(void *key, void *val, void *dat) +emf_free_cache(struct _EMFormatCache *efc) { - struct _EMFormatCache *efc = val; - if (efc->valid) camel_cipher_validity_free(efc->valid); if (efc->secured) @@ -119,7 +117,10 @@ emf_init(GObject *o) { EMFormat *emf = (EMFormat *)o; - emf->inline_table = g_hash_table_new(g_str_hash, g_str_equal); + emf->inline_table = g_hash_table_new_full ( + g_str_hash, g_str_equal, + (GDestroyNotify) NULL, + (GDestroyNotify) emf_free_cache); emf->composer = FALSE; emf->show_photo = TRUE; emf->photo_local = TRUE; @@ -136,7 +137,6 @@ emf_finalise(GObject *o) if (emf->session) camel_object_unref(emf->session); - g_hash_table_foreach(emf->inline_table, emf_free_cache, NULL); g_hash_table_destroy(emf->inline_table); em_format_clear_headers(emf); @@ -642,9 +642,7 @@ emf_format_clone(EMFormat *emf, CamelFolder *folder, const char *uid, CamelMimeM em_format_clear_puri_tree(emf); if (emf != emfsource) { - g_hash_table_foreach(emf->inline_table, emf_free_cache, NULL); - g_hash_table_destroy(emf->inline_table); - emf->inline_table = g_hash_table_new(g_str_hash, g_str_equal); + g_hash_table_remove_all(emf->inline_table); if (emfsource) { struct _EMFormatHeader *h; -- cgit v1.2.3