mirror of
https://gitlab.freedesktop.org/wayland/wayland.git
synced 2025-10-31 22:25:25 -04:00
client: cancel read in wl_display_read_events() when last_error is set
Calling wl_display_read_events() after an error should be equivalent to wl_display_cancel_read(), so that display state is consistent. Thanks to Pekka Paalanen <pekka.paalanen@collabora.co.uk> for pointing that out. Signed-off-by: Marek Chalupa <mchqwerty@gmail.com> Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
This commit is contained in:
parent
a31a736009
commit
083d8da432
1 changed files with 10 additions and 3 deletions
|
|
@ -1192,6 +1192,14 @@ read_events(struct wl_display *display)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
cancel_read(struct wl_display *display)
|
||||||
|
{
|
||||||
|
display->reader_count--;
|
||||||
|
if (display->reader_count == 0)
|
||||||
|
display_wakeup_threads(display);
|
||||||
|
}
|
||||||
|
|
||||||
/** Read events from display file descriptor
|
/** Read events from display file descriptor
|
||||||
*
|
*
|
||||||
* \param display The display context object
|
* \param display The display context object
|
||||||
|
|
@ -1219,6 +1227,7 @@ wl_display_read_events(struct wl_display *display)
|
||||||
pthread_mutex_lock(&display->mutex);
|
pthread_mutex_lock(&display->mutex);
|
||||||
|
|
||||||
if (display->last_error) {
|
if (display->last_error) {
|
||||||
|
cancel_read(display);
|
||||||
pthread_mutex_unlock(&display->mutex);
|
pthread_mutex_unlock(&display->mutex);
|
||||||
|
|
||||||
errno = display->last_error;
|
errno = display->last_error;
|
||||||
|
|
@ -1365,9 +1374,7 @@ wl_display_cancel_read(struct wl_display *display)
|
||||||
{
|
{
|
||||||
pthread_mutex_lock(&display->mutex);
|
pthread_mutex_lock(&display->mutex);
|
||||||
|
|
||||||
display->reader_count--;
|
cancel_read(display);
|
||||||
if (display->reader_count == 0)
|
|
||||||
display_wakeup_threads(display);
|
|
||||||
|
|
||||||
pthread_mutex_unlock(&display->mutex);
|
pthread_mutex_unlock(&display->mutex);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue