summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUli Schlachter <psychon@znc.in>2017-03-07 10:05:43 +0100
committerUli Schlachter <psychon@znc.in>2017-03-07 13:40:21 +0100
commit10e4103a508f81a3e47938e97c0b84f1ba41071c (patch)
treebc3115de54ecff82881bddf9c43a08757cfb2cef
parentf02ee3d3cf4168b5468b6548fe8823e803650f53 (diff)
xlib: Call XSync() before ignoring errors
The code here wants to ignore errors for a specific request. To do so, it sets a no-op error handler. However, it could happen that some previous request caused an error and this error will also be ignored by the no-op error handler. To avoid this, call XSync() before setting the error handler. This makes sure that all pending errors are handled. Signed-off-by: Uli Schlachter <psychon@znc.in> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--src/cairo-xlib-surface.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/cairo-xlib-surface.c b/src/cairo-xlib-surface.c
index 84e7c8e49..908d76daf 100644
--- a/src/cairo-xlib-surface.c
+++ b/src/cairo-xlib-surface.c
@@ -787,6 +787,7 @@ _get_image_surface (cairo_xlib_surface_t *surface,
_cairo_xlib_shm_surface_get_ximage (&image->base, &shm_image);
+ XSync (display->display, False);
old_handler = XSetErrorHandler (_noop_error_handler);
success = XShmGetImage (display->display,
surface->drawable,
@@ -808,6 +809,7 @@ _get_image_surface (cairo_xlib_surface_t *surface,
if (surface->use_pixmap == 0) {
cairo_xlib_error_func_t old_handler;
+ XSync (display->display, False);
old_handler = XSetErrorHandler (_noop_error_handler);
ximage = XGetImage (display->display,