xcb: Check the check for errors in boilerplate

We have to make sure we received all errors that the X server sent out before we
can be sure there are none. To do so, we just have to send some request and wait
for its reply, because that guarantees that the replies/errors to all previous
requests were received.

_cairo_boilerplate_xcb_synchronize doesn't need this, because the GetImage
request already makes sure we received everything.

Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
Uli Schlachter 2011-01-04 12:36:42 +01:00
parent 51626ed2ee
commit 673c44d3e8

View file

@ -78,6 +78,13 @@ _cairo_boilerplate_xcb_handle_errors (xcb_target_closure_t *xtc)
return CAIRO_STATUS_SUCCESS;
}
static void
_cairo_boilerplate_xcb_sync_server (xcb_target_closure_t *xtc)
{
free (xcb_get_input_focus_reply (xtc->c,
xcb_get_input_focus (xtc->c), NULL));
}
static void
_cairo_boilerplate_xcb_cleanup (void *closure)
{
@ -93,6 +100,9 @@ _cairo_boilerplate_xcb_cleanup (void *closure)
cairo_device_finish (xtc->device);
cairo_device_destroy (xtc->device);
/* First synchronize with the X server to make sure there are no more errors
* in-flight which we would miss otherwise */
_cairo_boilerplate_xcb_sync_server (xtc);
status = _cairo_boilerplate_xcb_handle_errors (xtc);
assert (status == CAIRO_STATUS_SUCCESS);
@ -637,6 +647,9 @@ _cairo_boilerplate_xcb_finish_surface (cairo_surface_t *surface)
if (cairo_surface_status (surface))
return cairo_surface_status (surface);
/* First synchronize with the X server to make sure there are no more errors
* in-flight which we would miss otherwise */
_cairo_boilerplate_xcb_sync_server (xtc);
status = _cairo_boilerplate_xcb_handle_errors (xtc);
if (status)
return status;