[libwnck] xutils: add error trap in try_pixmap_and_mask



commit 700771086205be0bf36861265abdd3bc027dd866
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date:   Sat Jun 18 00:50:39 2016 +0300

    xutils: add error trap in try_pixmap_and_mask
    
    https://bugs.freedesktop.org/show_bug.cgi?id=91967
    This cairo bug has reproducer that can trigger X error in libwnck.
    
    Add error trap in try_pixmap_and_mask to make sure that we don't
    crash with X error when pixmap that is used for drawing is destroyed.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=767803

 libwnck/xutils.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
---
diff --git a/libwnck/xutils.c b/libwnck/xutils.c
index 02ce741..e7dc56a 100644
--- a/libwnck/xutils.c
+++ b/libwnck/xutils.c
@@ -1796,6 +1796,8 @@ try_pixmap_and_mask (Screen     *screen,
   if (surface == NULL)
     return FALSE;
 
+  gdk_error_trap_push ();
+
   width = cairo_xlib_surface_get_width (surface);
   height = cairo_xlib_surface_get_height (surface);
 
@@ -1834,6 +1836,12 @@ try_pixmap_and_mask (Screen     *screen,
   cairo_surface_destroy (surface);
   cairo_destroy (cr);
 
+  if (gdk_error_trap_pop () != Success)
+    {
+      cairo_surface_destroy (image);
+      return FALSE;
+    }
+
   unscaled = gdk_pixbuf_get_from_surface (image,
                                           0, 0,
                                           width, height);


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