summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Persch <chpe@gnome.org>2008-10-20 16:56:14 +0000
committerChristian Persch <chpe@src.gnome.org>2008-10-20 16:56:14 +0000
commitfdaf62e88226e2eba3ba04657a883c564702a6e5 (patch)
treebfce1c31835d54fe5fb78d3361e5c49cd15ee723
parent28813733d30a31f2ec52356582bf24d234688e61 (diff)
downloadgdk-pixbuf-fdaf62e88226e2eba3ba04657a883c564702a6e5.tar.gz
Bug 557059 – crash when compositing emblems with icon
2008-10-20 Christian Persch <chpe@gnome.org> Bug 557059 – crash when compositing emblems with icon * gtk/gtkicontheme.c: (apply_emblems): Copy the pixbuf before using it with gtk_pixbuf_composite, in case its pixdata is read-only (mmaped from icon cache or builtins). svn path=/branches/gtk-2-14/; revision=21691
-rw-r--r--ChangeLog8
-rw-r--r--gtk/gtkicontheme.c23
2 files changed, 27 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 77b6563a7..f67185c74 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2008-10-20 Christian Persch <chpe@gnome.org>
+
+ Bug 557059 – crash when compositing emblems with icon
+
+ * gtk/gtkicontheme.c: (apply_emblems): Copy the pixbuf before using it
+ with gtk_pixbuf_composite, in case its pixdata is read-only (mmaped
+ from icon cache or builtins).
+
2008-10-18 Tor Lillqvist <tml@novell.com>
* gdk/win32/gdkevents-win32.c (gdk_event_translate): On
diff --git a/gtk/gtkicontheme.c b/gtk/gtkicontheme.c
index 04ef756ba..5fc1b3b20 100644
--- a/gtk/gtkicontheme.c
+++ b/gtk/gtkicontheme.c
@@ -2776,13 +2776,15 @@ static gboolean icon_info_ensure_scale_and_pixbuf (GtkIconInfo*, gboolean);
static void
apply_emblems (GtkIconInfo *info)
{
- GdkPixbuf *icon;
+ GdkPixbuf *icon = NULL;
gint w, h, pos;
GSList *l;
- icon = info->pixbuf;
- w = gdk_pixbuf_get_width (icon);
- h = gdk_pixbuf_get_height (icon);
+ if (info->emblem_infos == NULL)
+ return;
+
+ w = gdk_pixbuf_get_width (info->pixbuf);
+ h = gdk_pixbuf_get_height (info->pixbuf);
for (l = info->emblem_infos, pos = 0; l; l = l->next, pos++)
{
@@ -2826,10 +2828,23 @@ apply_emblems (GtkIconInfo *info)
break;
}
+ if (icon == NULL)
+ {
+ icon = gdk_pixbuf_copy (info->pixbuf);
+ if (icon == NULL)
+ break;
+ }
+
gdk_pixbuf_composite (emblem, icon, x, y, ew, eh, x, y,
scale, scale, GDK_INTERP_BILINEAR, 255);
}
}
+
+ if (icon)
+ {
+ g_object_unref (info->pixbuf);
+ info->pixbuf = icon;
+ }
}
/* This function contains the complicated logic for deciding