From 515526399a7f11480c4077c55cdde9c5a796aca4 Mon Sep 17 00:00:00 2001 From: Marco Pesenti Gritti Date: Sat, 28 Jun 2003 23:52:49 +0000 Subject: Emit the changed signal before unrefing the persist object. The changed 2003-06-29 Marco Pesenti Gritti * embed/ephy-favicon-cache.c: (favicon_download_completed_cb), (ephy_favicon_cache_download), (ephy_favicon_cache_get): Emit the changed signal before unrefing the persist object. The changed url is set_data_full on it and it will be freed otherwise. Make sure we never emit signals with NULL url. --- embed/ephy-favicon-cache.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'embed') diff --git a/embed/ephy-favicon-cache.c b/embed/ephy-favicon-cache.c index c2475cd41..f5a7f8c77 100644 --- a/embed/ephy-favicon-cache.c +++ b/embed/ephy-favicon-cache.c @@ -388,12 +388,13 @@ favicon_download_completed_cb (EphyEmbedPersist *persist, { char *url; - url = g_object_get_data (G_OBJECT (persist), "url"), + url = g_object_get_data (G_OBJECT (persist), "url"); + g_return_if_fail (url != NULL); + + g_signal_emit (G_OBJECT (cache), ephy_favicon_cache_signals[CHANGED], 0, url); g_hash_table_remove (cache->priv->downloads_hash, url); g_object_unref (persist); - - g_signal_emit (G_OBJECT (cache), ephy_favicon_cache_signals[CHANGED], 0, url); } static void @@ -429,10 +430,10 @@ ephy_favicon_cache_download (EphyFaviconCache *cache, G_CALLBACK (favicon_download_completed_cb), cache); - ephy_embed_persist_save (persist); - g_hash_table_insert (cache->priv->downloads_hash, g_strdup (favicon_url), persist); + + ephy_embed_persist_save (persist); } GdkPixbuf * @@ -445,6 +446,8 @@ ephy_favicon_cache_get (EphyFaviconCache *cache, char *pix_file; GdkPixbuf *pixbuf; + if (url == NULL) return NULL; + now = time (NULL); g_static_rw_lock_reader_lock (cache->priv->icons_hash_lock); -- cgit v1.2.3