Add break from main loop when X conn has error

This commit is contained in:
John Vogel 2015-01-06 18:37:08 -05:00
parent 5746d15cf8
commit 145c66b471
1 changed files with 4 additions and 0 deletions

4
bar.c
View File

@ -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 */