mirror of
https://gitlab.freedesktop.org/wayland/wayland.git
synced 2025-11-01 22:58:40 -04:00
client: Fix handling display->reader_count if poll fails
In wl_display_dispatch_queue, if poll fails then it would previously return immediately and leak a reference in display->reader_count. Then if the application ignores the error and tries to read again it will block forever. This can happen for example if the poll fails with EINTR which the application might consider to be a recoverable error. This patch makes it cancel the read so the reader_count will be decremented when poll fails.
This commit is contained in:
parent
4125367f20
commit
799ea7206b
1 changed files with 3 additions and 1 deletions
|
|
@ -1210,8 +1210,10 @@ wl_display_dispatch_queue(struct wl_display *display,
|
|||
|
||||
pfd[0].fd = display->fd;
|
||||
pfd[0].events = POLLIN;
|
||||
if (poll(pfd, 1, -1) == -1)
|
||||
if (poll(pfd, 1, -1) == -1) {
|
||||
wl_display_cancel_read(display);
|
||||
return -1;
|
||||
}
|
||||
|
||||
pthread_mutex_lock(&display->mutex);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue