From f8277dfdaf60ebb1d6c60780cff559497780b5b6 Mon Sep 17 00:00:00 2001 From: Uli Schlachter Date: Tue, 4 Jan 2011 13:05:03 +0100 Subject: [PATCH] xcb: Only print the first error and ignore subsequent ones It is quite likely that following errors are caused by the previous ones. To avoid flooding users we now silently discard all the errors and events after the first one. Signed-off-by: Uli Schlachter --- boilerplate/cairo-boilerplate-xcb.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/boilerplate/cairo-boilerplate-xcb.c b/boilerplate/cairo-boilerplate-xcb.c index dee0eaba2..149ee7b6a 100644 --- a/boilerplate/cairo-boilerplate-xcb.c +++ b/boilerplate/cairo-boilerplate-xcb.c @@ -594,7 +594,7 @@ _cairo_boilerplate_xcb_finish_surface (cairo_surface_t *surface) if (cairo_surface_status (surface)) return cairo_surface_status (surface); - while ((ev = xcb_poll_for_event (xtc->c)) != NULL) { + if ((ev = xcb_poll_for_event (xtc->c)) != NULL) { if (ev->response_type == CAIRO_XCB_ERROR) { xcb_generic_error_t *error = (xcb_generic_error_t *) ev; @@ -614,6 +614,10 @@ _cairo_boilerplate_xcb_finish_surface (cairo_surface_t *surface) } free (ev); + /* Silently discard all following errors */ + while ((ev = xcb_poll_for_event (xtc->c)) != NULL) + free (ev); + return CAIRO_STATUS_WRITE_ERROR; }