From b43b06d31c94f6c03afec4fb951bd92c41b758b2 Mon Sep 17 00:00:00 2001 From: Julian Orth Date: Fri, 18 Apr 2025 16:31:50 +0200 Subject: [PATCH] client: reject prepare_read if the display queue has events The display queue is dispatched when and only when any other queue is dispatched. Therefore, a client that only ever dispatches in response to prepare_read returning -1 would never dispatch wl_display.error events. Signed-off-by: Julian Orth --- src/wayland-client.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/wayland-client.c b/src/wayland-client.c index 8df160b4..cbe16800 100644 --- a/src/wayland-client.c +++ b/src/wayland-client.c @@ -1898,10 +1898,13 @@ wl_display_prepare_read_queue(struct wl_display *display, struct wl_event_queue *queue) { int ret; + bool has_events; pthread_mutex_lock(&display->mutex); - if (!wl_list_empty(&queue->event_list)) { + has_events = !wl_list_empty(&queue->event_list) || + !wl_list_empty(&display->display_queue.event_list); + if (has_events) { errno = EAGAIN; ret = -1; } else {