compiz (0.8.4-4) 014-fix-gtk-window-decorator-no-argb-crash.patch

Summary

 gtk/window-decorator/gtk-window-decorator.c |   17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)

    
download this patch

Patch contents

Author: Sebastien Bacher <seb128@canonical.com>
Description: Fix decorator crash when ARGB isn't enabled
 Fix gtk-window-decorator crash when ARGB isn't enabled and only
 that, in this case window-decoration are invisible
Origin: vendor, ubuntu (1:0.3.6-1ubuntu9)
Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/compiz/+bug/94140
Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/compiz/+bug/82205
--- compiz.orig/gtk/window-decorator/gtk-window-decorator.c
+++ compiz/gtk/window-decorator/gtk-window-decorator.c
@@ -1918,10 +1918,8 @@ meta_draw_window_decoration (decor_t *d)
 
     size = MAX (fgeom.top_height, fgeom.bottom_height);
 
-    if (rect.width && size)
+    if (rect.width && size && (pixmap = create_pixmap (rect.width, size)))
     {
-	pixmap = create_pixmap (rect.width, size);
-
 	cr = gdk_cairo_create (GDK_DRAWABLE (pixmap));
 	gdk_cairo_set_source_color_alpha (cr, &bg_color, bg_alpha);
 	cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
@@ -2020,10 +2018,8 @@ meta_draw_window_decoration (decor_t *d)
 
     size = MAX (fgeom.left_width, fgeom.right_width);
 
-    if (size && rect.height)
+    if (size && rect.height && (pixmap = create_pixmap (size, rect.height)))
     {
-	pixmap = create_pixmap (size, rect.height);
-
 	cr = gdk_cairo_create (GDK_DRAWABLE (pixmap));
 	gdk_cairo_set_source_color_alpha (cr, &bg_color, bg_alpha);
 	cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
@@ -3320,9 +3316,12 @@ update_window_decoration_icon (WnckWindo
 	g_object_ref (G_OBJECT (d->icon_pixbuf));
 
 	d->icon_pixmap = pixmap_new_from_pixbuf (d->icon_pixbuf);
-	cr = gdk_cairo_create (GDK_DRAWABLE (d->icon_pixmap));
-	d->icon = cairo_pattern_create_for_surface (cairo_get_target (cr));
-	cairo_destroy (cr);
+	if (d->icon_pixmap)
+	{
+	    cr = gdk_cairo_create (GDK_DRAWABLE (d->icon_pixmap));
+	    d->icon = cairo_pattern_create_for_surface (cairo_get_target (cr));
+	    cairo_destroy (cr);
+	}
     }
 }