From 0db32f0632ef4675bfcfc9ec201f7af157a48ab0 Mon Sep 17 00:00:00 2001 From: Giovanni Campagna Date: Fri, 1 Mar 2013 23:45:43 +0100 Subject: [PATCH] GtkIconTheme: fix failed assertion when asynchrnously loading emblemed icons 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 | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/gtk/gtkicontheme.c b/gtk/gtkicontheme.c index 73d8ba7d0..5d7a2f956 100644 --- a/gtk/gtkicontheme.c +++ b/gtk/gtkicontheme.c @@ -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) { -- 2.43.2