[cairo-xlib-surface] Check for errors before installing a NOOP error handler.

Call XSync before ignoring errors from XGetImage to avoid hiding
unassociated errors. Similarly, call XSync before reinstalling the old
error handler to ensure no errors creep out of the ignored section.
This commit is contained in:
Chris Wilson 2007-06-15 20:45:53 +01:00
parent 0c5d28a4e5
commit 7016614dd9

View file

@ -542,6 +542,7 @@ _get_image_surface (cairo_xlib_surface_t *surface,
{
cairo_xlib_error_func_t old_handler;
XSync (surface->dpy, False);
old_handler = XSetErrorHandler (_noop_error_handler);
ximage = XGetImage (surface->dpy,
@ -550,6 +551,7 @@ _get_image_surface (cairo_xlib_surface_t *surface,
x2 - x1, y2 - y1,
AllPlanes, ZPixmap);
XSync (surface->dpy, False);
XSetErrorHandler (old_handler);
/* If we get an error, the surface must have been a window,