]> Pileus Git - ~andy/gtk/commitdiff
GtkIconTheme: fix failed assertion when asynchrnously loading emblemed icons
authorGiovanni Campagna <gcampagna@src.gnome.org>
Fri, 1 Mar 2013 22:45:43 +0000 (23:45 +0100)
committerGiovanni Campagna <gcampagna@src.gnome.org>
Mon, 4 Mar 2013 15:28:00 +0000 (16:28 +0100)
If you tried to lookup an icon that was not emblemed, and then looked up
an emblemed icon with the same base, we would override the iconinfo adding
the emblems inline. Later, when the icon finished rendering, inside
gtk_icon_info_load_icon_finish, we would copy the result from the duplicate
(which did not include the emblem infos), but the icon would still fail the
assertion, because emblems infos are present but emblem_applied is false
(they were not requested in the first place!).
Solve this by avoiding the overwrite on a cached iconinfo, and instead duplicate
the iconinfo before adding the emblems. It is expected that another layer
of caching (such as StTextureCache in gnome-shell) will take care of avoiding
multiple rendering of the same icon+emblem combination.

https://bugzilla.gnome.org/show_bug.cgi?id=694968

gtk/gtkicontheme.c

index 73d8ba7d0fef2324c96dca4aaca822f57564fed7..5d7a2f956933e503f007a87d9397c06f76145fd5 100644 (file)
@@ -4885,15 +4885,18 @@ gtk_icon_theme_lookup_by_gicon (GtkIconTheme       *icon_theme,
     {
       GIcon *base, *emblem;
       GList *list, *l;
-      GtkIconInfo *emblem_info;
+      GtkIconInfo *base_info, *emblem_info;
 
       if (GTK_IS_NUMERABLE_ICON (icon))
         _gtk_numerable_icon_set_background_icon_size (GTK_NUMERABLE_ICON (icon), size / 2);
 
       base = g_emblemed_icon_get_icon (G_EMBLEMED_ICON (icon));
-      info = gtk_icon_theme_lookup_by_gicon (icon_theme, base, size, flags);
-      if (info)
+      base_info = gtk_icon_theme_lookup_by_gicon (icon_theme, base, size, flags);
+      if (base_info)
         {
+          info = icon_info_dup (base_info);
+          g_object_unref (base_info);
+
           list = g_emblemed_icon_get_emblems (G_EMBLEMED_ICON (icon));
           for (l = list; l; l = l->next)
             {