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>
This commit is contained in:
Uli Schlachter 2017-03-07 10:05:43 +01:00 committed by Bryce Harrington
parent 2d47ccbc01
commit 2f830badef

View file

@ -793,6 +793,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,
@ -814,6 +815,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,