From 673c44d3e85e31d6411598706dc025cd474b7dcf Mon Sep 17 00:00:00 2001 From: Uli Schlachter Date: Tue, 4 Jan 2011 12:36:42 +0100 Subject: [PATCH] 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 --- boilerplate/cairo-boilerplate-xcb.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/boilerplate/cairo-boilerplate-xcb.c b/boilerplate/cairo-boilerplate-xcb.c index 67c8163c0..e45a2dc18 100644 --- a/boilerplate/cairo-boilerplate-xcb.c +++ b/boilerplate/cairo-boilerplate-xcb.c @@ -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;