summaryrefslogtreecommitdiff
path: root/boilerplate/cairo-boilerplate-xcb.c
diff options
context:
space:
mode:
authorUli Schlachter <psychon@znc.in>2011-01-04 12:36:42 +0100
committerUli Schlachter <psychon@znc.in>2011-01-05 22:04:45 +0100
commit673c44d3e85e31d6411598706dc025cd474b7dcf (patch)
treedb29f0c4c43f3ed47ba568c0225b7865b711cfcf /boilerplate/cairo-boilerplate-xcb.c
parent51626ed2eed1abd7c540160988017c101da28952 (diff)
downloadcairo-673c44d3e85e31d6411598706dc025cd474b7dcf.tar.gz
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>
Diffstat (limited to 'boilerplate/cairo-boilerplate-xcb.c')
-rw-r--r--boilerplate/cairo-boilerplate-xcb.c13
1 files changed, 13 insertions, 0 deletions
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
@@ -79,6 +79,13 @@ _cairo_boilerplate_xcb_handle_errors (xcb_target_closure_t *xtc)
}
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)
{
xcb_target_closure_t *xtc = 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;