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

Chris Wilson chris at chris-wilson.co.uk
Tue Mar 7 10:31:13 UTC 2017


On Tue, Mar 07, 2017 at 11:21:31AM +0100, Uli Schlachter wrote:
> 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);

I was thinking if only we could check for an error from this request,
and remembered this is not xcb.
Reviewed-by: Chris Wilson <chris at chris-wilson.co.uk>
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre


More information about the cairo mailing list