From d243a836ce55dff647f8e744441fbd2c3343cfa1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ekl=C3=B6f?= Date: Sat, 4 Jan 2020 23:32:00 +0100 Subject: [PATCH] wayland: only call wl_display_prepare_read() if we read any events That is, only call it if we have POLLIN. If not, then we never read any events and we still hold the read lock and thus we shouldn't try to acquire it again. --- wayland.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/wayland.c b/wayland.c index ee304bd3..a4868ee7 100644 --- a/wayland.c +++ b/wayland.c @@ -569,11 +569,12 @@ fdm_wayl(struct fdm *fdm, int fd, int events, void *data) struct wayland *wayl = data; int event_count = 0; - if (events & EPOLLIN) + if (events & EPOLLIN) { wl_display_read_events(wayl->display); - while (wl_display_prepare_read(wayl->display) != 0) - wl_display_dispatch_pending(wayl->display); + while (wl_display_prepare_read(wayl->display) != 0) + wl_display_dispatch_pending(wayl->display); + } if (events & EPOLLHUP) { LOG_WARN("disconnected from Wayland");