summaryrefslogtreecommitdiff
path: root/libwnck/xutils.c
diff options
context:
space:
mode:
authorAlberts Muktupāvels <alberts.muktupavels@gmail.com>2016-06-18 00:50:39 +0300
committerMarco Trevisan (Treviño) <mail@3v1n0.net>2016-06-21 15:14:26 +0200
commit700771086205be0bf36861265abdd3bc027dd866 (patch)
tree7947e25c129302ccb4f8a9eeb6e3a6d42cf4336d /libwnck/xutils.c
parent7da939976014f791b9643b79bdefa2bc01a3b0b0 (diff)
downloadlibwnck-700771086205be0bf36861265abdd3bc027dd866.tar.gz
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
Diffstat (limited to 'libwnck/xutils.c')
-rw-r--r--libwnck/xutils.c8
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);