gtk+ r21691 - in branches/gtk-2-14: . gtk



Author: chpe
Date: Mon Oct 20 16:56:14 2008
New Revision: 21691
URL: http://svn.gnome.org/viewvc/gtk+?rev=21691&view=rev

Log:
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).

Modified:
   branches/gtk-2-14/ChangeLog
   branches/gtk-2-14/gtk/gtkicontheme.c

Modified: branches/gtk-2-14/gtk/gtkicontheme.c
==============================================================================
--- branches/gtk-2-14/gtk/gtkicontheme.c	(original)
+++ branches/gtk-2-14/gtk/gtkicontheme.c	Mon Oct 20 16:56:14 2008
@@ -2776,13 +2776,15 @@
 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 @@
               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



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