diff --git a/src/wayland-client.c b/src/wayland-client.c index 01629e01..7df22d09 100644 --- a/src/wayland-client.c +++ b/src/wayland-client.c @@ -1190,6 +1190,11 @@ read_events(struct wl_display *display) while (display->read_serial == serial) pthread_cond_wait(&display->reader_cond, &display->mutex); + + if (display->last_error) { + errno = display->last_error; + return -1; + } } return 0; diff --git a/tests/display-test.c b/tests/display-test.c index aecf3411..d5f4d00c 100644 --- a/tests/display-test.c +++ b/tests/display-test.c @@ -369,9 +369,9 @@ thread_read_error(void *data) * thread should be woken up or it will block indefinitely. */ c->display_stopped = 1; - assert(wl_display_read_events(c->wl_display) == 0); + assert(wl_display_read_events(c->wl_display) == -1); - wl_display_dispatch_pending(c->wl_display); + assert(wl_display_dispatch_pending(c->wl_display) == -1); assert(wl_display_get_error(c->wl_display)); pthread_exit(NULL);