Handle null X events without error

This commit is contained in:
Aaron Ash 2017-04-14 12:14:08 +10:00 committed by Dave Davenport
parent d6af6d29fc
commit 1bfbc327c2
1 changed files with 8 additions and 3 deletions

View File

@ -662,9 +662,14 @@ static gboolean main_loop_x11_event_handler ( xcb_generic_event_t *ev, G_GNUC_UN
{
if ( ev == NULL ) {
int status = xcb_connection_has_error ( xcb->connection );
fprintf ( stderr, "The XCB connection to X server had a fatal error: %d\n", status );
g_main_loop_quit ( main_loop );
return G_SOURCE_REMOVE;
if(status > 0) {
fprintf ( stderr, "The XCB connection to X server had a fatal error: %d\n", status );
g_main_loop_quit ( main_loop );
return G_SOURCE_REMOVE;
} else {
fprintf ( stderr, "Warning: main_loop_x11_event_handler: ev == NULL, status == %d\n", status );
return G_SOURCE_CONTINUE;
}
}
uint8_t type = ev->response_type & ~0x80;
if ( type == xkb.first_event ) {