[cairo] [PATCH 2/2] xlib: Call XSync() before ignoring errors

Uli Schlachter psychon at znc.in
Tue Mar 7 10:21:31 UTC 2017


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 at znc.in>
---
 src/cairo-xlib-surface.c | 2 ++
 1 file changed, 2 insertions(+)

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,
-- 
2.11.0



More information about the cairo mailing list