mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-06-01 21:08:18 +02:00
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:
parent
51626ed2ee
commit
673c44d3e8
1 changed files with 13 additions and 0 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue