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
This commit is contained in:
Giovanni Campagna 2013-03-01 23:45:43 +01:00
parent 8075181033
commit 0db32f0632

View 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)
{