[PATCH 18/19] Xephyr: handle errors in event loop

Eric Anholt eric at anholt.net
Mon Aug 26 13:21:02 PDT 2013


From: Julien Cristau <jcristau at debian.org>

Signed-off-by: Julien Cristau <jcristau at debian.org>
Reviewed-by: Eric Anholt <eric at anholt.net>
Reviewed-by: Mikhail Gusarov <dottedmag at dottedmag.net>
---
 hw/kdrive/ephyr/hostx.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/hw/kdrive/ephyr/hostx.c b/hw/kdrive/ephyr/hostx.c
index 68bb48a..1eef64e 100644
--- a/hw/kdrive/ephyr/hostx.c
+++ b/hw/kdrive/ephyr/hostx.c
@@ -947,6 +947,21 @@ hostx_get_event(EphyrHostXEvent * ev)
     }
 
     switch (xev->response_type & 0x7f) {
+    case 0: { /* error */
+        xcb_generic_error_t *e = (xcb_generic_error_t *)xev;
+        fprintf(stderr, "X11 error\n"
+                "Error code: %hhu\n"
+                "Sequence number: %hu\n"
+                "Major code: %hhu\tMinor code: %hu\n"
+                "Error value: %u\n",
+                e->error_code,
+                e->sequence,
+                e->major_code, e->minor_code,
+                e->resource_id);
+        free(xev);
+        exit(1);
+    }
+
     case XCB_EXPOSE: {
         xcb_expose_event_t *expose = (xcb_expose_event_t *)xev;
         struct EphyrHostScreen *host_screen =
-- 
1.8.4.rc3



More information about the xorg-devel mailing list