From 145c66b47143cb22b9916424d45f849386b7c477 Mon Sep 17 00:00:00 2001 From: John Vogel Date: Tue, 6 Jan 2015 18:37:08 -0500 Subject: [PATCH] Add break from main loop when X conn has error --- bar.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/bar.c b/bar.c index 540c078..ba71f91 100644 --- a/bar.c +++ b/bar.c @@ -1119,6 +1119,10 @@ main (int argc, char **argv) for (;;) { bool redraw = false; + /* If connection is in error state, then it has been shut down. */ + if (xcb_connection_has_error(c)) + break; + if (poll(pollin, 2, -1) > 0) { if (pollin[0].revents & POLLHUP) { /* No more data... */ if (permanent) pollin[0].fd = -1; /* ...null the fd and continue polling :D */