Sophie

Sophie

distrib > Mageia > 5 > x86_64 > media > core-release-src > by-pkgid > d426b5b75d4a14e66ef2470f535b06d5 > files > 3

gnome-paint-0.4.0-4.mga5.src.rpm

Description: Fix a crash by clicking pencil then painter at toolbar.
Author: Juan Balderas <juan.balderas.0@gmail.com>
Bug-Ubuntu: 757607
Last-Update: 2011-05-24
--- a/src/toolbar.c
+++ b/src/toolbar.c
@@ -497,15 +497,22 @@
 static GtkWidget * 
 get_gtk_image ( GtkWidget *widget, gchar** xpm )
 {
-	GdkPixmap *gdkpixmap	= NULL;
-    GdkBitmap *mask 		= NULL;
+	GdkPixbuf *pixbuf		= NULL;
     GtkWidget *gtkimage 	= NULL;
-	gdkpixmap = gdk_pixmap_create_from_xpm_d(widget->window, &mask, NULL, xpm);
-	g_assert ( gdkpixmap );
-	gtkimage = gtk_image_new_from_pixmap(gdkpixmap, mask);
-    g_assert ( gtkimage );
-	g_object_unref ( G_OBJECT(gdkpixmap) );
-    g_object_unref ( G_OBJECT(mask) ); 
+
+	pixbuf = gdk_pixbuf_new_from_xpm_data (xpm);
+
+	if(!gdk_pixbuf_get_has_alpha (pixbuf))
+	{
+		GdkPixbuf *tmp;
+
+		tmp = gdk_pixbuf_add_alpha (pixbuf, FALSE, 0, 0, 0);
+		if(GDK_IS_PIXBUF(tmp)){ g_object_unref(pixbuf); pixbuf = tmp; }
+	}
+	gtkimage = gtk_image_new_from_pixbuf (pixbuf);
+
+	if(GDK_IS_PIXBUF(pixbuf)){ g_object_unref(pixbuf); }
+
 	gtk_widget_show(gtkimage);
 	return gtkimage;
 }