diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2007-10-02 19:54:42 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@src.gnome.org> | 2007-10-02 19:54:42 +0800 |
commit | 09d4af6fff63dd112b8bb42087f14f7018e2f78c (patch) | |
tree | 991537a9ea1d8487334f6fb299098daf425f9db8 /mail/em-format-html.c | |
parent | 79521efaeecfbaf717e465670fcd2724aea53578 (diff) | |
download | gsoc2013-evolution-09d4af6fff63dd112b8bb42087f14f7018e2f78c.tar.gz gsoc2013-evolution-09d4af6fff63dd112b8bb42087f14f7018e2f78c.tar.zst gsoc2013-evolution-09d4af6fff63dd112b8bb42087f14f7018e2f78c.zip |
** Fixes bug #469657
2007-10-02 Matthew Barnes <mbarnes@redhat.com>
** 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
Diffstat (limited to 'mail/em-format-html.c')
-rw-r--r-- | mail/em-format-html.c | 28 |
1 files changed, 13 insertions, 15 deletions
diff --git a/mail/em-format-html.c b/mail/em-format-html.c index b1961bd2b2..6953992f5a 100644 --- a/mail/em-format-html.c +++ b/mail/em-format-html.c @@ -127,6 +127,14 @@ static CamelDataCache *emfh_http_cache; #define EMFH_HTTP_CACHE_PATH "http" static void +efh_free_cache(struct _EMFormatHTMLCache *efhc) +{ + if (efhc->textmp) + camel_object_unref(efhc->textmp); + g_free(efhc); +} + +static void efh_init(GObject *o) { EMFormatHTML *efh = (EMFormatHTML *)o; @@ -137,7 +145,10 @@ efh_init(GObject *o) e_dlist_init(&efh->priv->pending_jobs); efh->priv->lock = g_mutex_new(); efh->priv->format_id = -1; - efh->priv->text_inline_parts = g_hash_table_new(g_str_hash, g_str_equal); + efh->priv->text_inline_parts = g_hash_table_new_full ( + g_str_hash, g_str_equal, + (GDestroyNotify) NULL, + (GDestroyNotify) efh_free_cache); efh->html = (GtkHTML *)gtk_html_new(); gtk_html_set_blocking(efh->html, FALSE); @@ -193,16 +204,6 @@ efh_insert_cache(EMFormatHTML *efh, const char *partid) static void -efh_free_cache(void *key, void *val, void *dat) -{ - struct _EMFormatHTMLCache *efhc = val; - - if (efhc->textmp) - camel_object_unref(efhc->textmp); - g_free(efhc); -} - -static void efh_finalise(GObject *o) { EMFormatHTML *efh = (EMFormatHTML *)o; @@ -213,7 +214,6 @@ efh_finalise(GObject *o) efh_gtkhtml_destroy(efh->html, efh); - g_hash_table_foreach(efh->priv->text_inline_parts, efh_free_cache, NULL); g_hash_table_destroy(efh->priv->text_inline_parts); g_free(efh->priv); @@ -1397,9 +1397,7 @@ efh_format_timeout(struct _format_msg *m) | GTK_HTML_BEGIN_BLOCK_UPDATES | GTK_HTML_BEGIN_BLOCK_IMAGES); } else { /* clear cache of inline-scanned text parts */ - g_hash_table_foreach(p->text_inline_parts, efh_free_cache, NULL); - g_hash_table_destroy(p->text_inline_parts); - p->text_inline_parts = g_hash_table_new(g_str_hash, g_str_equal); + g_hash_table_remove_all(p->text_inline_parts); p->last_part = m->message; } |