From 10e93c23ad520ed19e7d3e8ce253f847e439feab Mon Sep 17 00:00:00 2001 From: Jens Granseuer Date: Sun, 20 Apr 2008 10:29:49 +0000 Subject: [PATCH] unref the thumbnail image after passing it to the callback. Callers will 2008-04-20 Jens Granseuer * theme-thumbnail.c: (message_from_child): unref the thumbnail image after passing it to the callback. Callers will have to ref it if they want to keep it until after the callback has returned 2008-04-20 Jens Granseuer * appearance-style.c: (update_thumbnail_in_treeview): * appearance-themes.c: (theme_thumbnail_update), (theme_thumbnail_generate): adapt to modified refcounting in the thumbnailer; thumbnails don't need to be unref'ed unless we explicitly retain a reference svn path=/trunk/; revision=8661 --- capplets/appearance/ChangeLog | 8 ++++++++ capplets/appearance/appearance-style.c | 2 -- capplets/appearance/appearance-themes.c | 7 +++---- capplets/common/ChangeLog | 6 ++++++ capplets/common/theme-thumbnail.c | 5 ++++- 5 files changed, 21 insertions(+), 7 deletions(-) diff --git a/capplets/appearance/ChangeLog b/capplets/appearance/ChangeLog index e6bf3f249..c1256cba3 100644 --- a/capplets/appearance/ChangeLog +++ b/capplets/appearance/ChangeLog @@ -1,3 +1,11 @@ +2008-04-20 Jens Granseuer + + * appearance-style.c: (update_thumbnail_in_treeview): + * appearance-themes.c: (theme_thumbnail_update), + (theme_thumbnail_generate): adapt to modified refcounting in the + thumbnailer; thumbnails don't need to be unref'ed unless we explicitly + retain a reference + 2008-04-19 Jens Granseuer * Makefile.am: diff --git a/capplets/appearance/appearance-style.c b/capplets/appearance/appearance-style.c index 45176c28d..eade98f00 100644 --- a/capplets/appearance/appearance-style.c +++ b/capplets/appearance/appearance-style.c @@ -633,8 +633,6 @@ update_thumbnail_in_treeview (const gchar *tv_name, COL_THUMBNAIL, theme_thumbnail, -1); } - - g_object_unref (theme_thumbnail); } static void diff --git a/capplets/appearance/appearance-themes.c b/capplets/appearance/appearance-themes.c index de434c91c..0283ee231 100644 --- a/capplets/appearance/appearance-themes.c +++ b/capplets/appearance/appearance-themes.c @@ -114,8 +114,6 @@ theme_thumbnail_update (GdkPixbuf *pixbuf, g_free (path); } } - - g_object_unref (pixbuf); } static GdkPixbuf * @@ -159,9 +157,10 @@ theme_thumbnail_generate (GnomeThemeMetaInfo *info, AppearanceData *data) thumb = theme_get_thumbnail_from_cache (info, data); - if (thumb != NULL) + if (thumb != NULL) { theme_thumbnail_update (thumb, info->name, data, FALSE); - else + g_object_unref (thumb); + } else generate_meta_theme_thumbnail_async (info, (ThemeThumbnailFunc) theme_thumbnail_done_cb, data, NULL); } diff --git a/capplets/common/ChangeLog b/capplets/common/ChangeLog index 794325fe0..1662d643a 100644 --- a/capplets/common/ChangeLog +++ b/capplets/common/ChangeLog @@ -1,3 +1,9 @@ +2008-04-20 Jens Granseuer + + * theme-thumbnail.c: (message_from_child): unref the thumbnail image + after passing it to the callback. Callers will have to ref it if they + want to keep it until after the callback has returned + 2008-04-19 Jens Granseuer * gtkrc-utils.c: (gtkrc_get_details): accept NULL for the diff --git a/capplets/common/theme-thumbnail.c b/capplets/common/theme-thumbnail.c index 337833703..8827b5a0b 100644 --- a/capplets/common/theme-thumbnail.c +++ b/capplets/common/theme-thumbnail.c @@ -842,12 +842,15 @@ message_from_child (GIOChannel *source, memcpy (pixels + rowstride * i, async_data.data->data + 4 * async_data.thumbnail_width * i, async_data.thumbnail_width * 4); } - /* callback function needs to unref the pixbuf */ + /* callback function needs to ref the pixbuf if it wants to keep it */ (* async_data.func) (pixbuf, async_data.theme_name, async_data.user_data); if (async_data.destroy) (* async_data.destroy) (async_data.user_data); + if (pixbuf) + g_object_unref (pixbuf); + /* Clean up async_data */ g_free (async_data.theme_name); g_source_remove (async_data.watch_id);