[gtk+] icontheme: fix emblemed icons fallout



commit 99dc47e7fd2cd5c5afa5777202a00ea85f19c359
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Mon Mar 24 20:14:43 2014 -0400

    icontheme: fix emblemed icons fallout
    
    Commit faba7df4fea6cd09470b3b2cc277c35e6cf7c380 changed the logic in
    apply_emblems() so that GtkIconInfo->emblems_applied would be set to
    TRUE even in case there was no emblem info available, which confuses the
    theme cache.
    This commit changes the logic back, so that NULL is returned from
    apply_emblems_to_pixbuf() when there are no emblems available, fixing
    the bug.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=726830

 gtk/gtkicontheme.c |   14 ++++++++------
 1 files changed, 8 insertions(+), 6 deletions(-)
---
diff --git a/gtk/gtkicontheme.c b/gtk/gtkicontheme.c
index 0eb44bd..7b22921 100644
--- a/gtk/gtkicontheme.c
+++ b/gtk/gtkicontheme.c
@@ -3578,7 +3578,7 @@ apply_emblems_to_pixbuf (GdkPixbuf *pixbuf,
   GSList *l;
 
   if (info->emblem_infos == NULL)
-    return g_object_ref (pixbuf);
+    return NULL;
 
   w = gdk_pixbuf_get_width (pixbuf);
   h = gdk_pixbuf_get_height (pixbuf);
@@ -3658,9 +3658,8 @@ apply_emblems (GtkIconInfo *info)
     {
       g_object_unref (info->pixbuf);
       info->pixbuf = icon;
+      info->emblems_applied = TRUE;
     }
-
-  info->emblems_applied = TRUE;
 }
 
 /* If this returns TRUE, its safe to call
@@ -4174,7 +4173,7 @@ symbolic_cache_get_proxy (SymbolicPixbufCache *symbolic_cache,
 }
 
 static GdkPixbuf *
-_gtk_icon_info_load_symbolic_internal (GtkIconInfo  *icon_info,
+_gtk_icon_info_load_symbolic_internal (GtkIconInfo    *icon_info,
                                       const GdkRGBA  *fg,
                                       const GdkRGBA  *success_color,
                                       const GdkRGBA  *warning_color,
@@ -4305,8 +4304,11 @@ _gtk_icon_info_load_symbolic_internal (GtkIconInfo  *icon_info,
       GdkPixbuf *icon;
 
       icon = apply_emblems_to_pixbuf (pixbuf, icon_info);
-      g_object_unref (pixbuf);
-      pixbuf = icon;
+      if (icon != NULL)
+        {
+          g_object_unref (pixbuf);
+          pixbuf = icon;
+        }
 
       if (use_cache)
        {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]