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
|
@ -1192,6 +1192,14 @@ read_events(struct wl_display *display)
|
|||
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
|
||||
*
|
||||
* \param display The display context object
|
||||
|
@ -1219,6 +1227,7 @@ wl_display_read_events(struct wl_display *display)
|
|||
pthread_mutex_lock(&display->mutex);
|
||||
|
||||
if (display->last_error) {
|
||||
cancel_read(display);
|
||||
pthread_mutex_unlock(&display->mutex);
|
||||
|
||||
errno = display->last_error;
|
||||
|
@ -1365,9 +1374,7 @@ wl_display_cancel_read(struct wl_display *display)
|
|||
{
|
||||
pthread_mutex_lock(&display->mutex);
|
||||
|
||||
display->reader_count--;
|
||||
if (display->reader_count == 0)
|
||||
display_wakeup_threads(display);
|
||||
cancel_read(display);
|
||||
|
||||
pthread_mutex_unlock(&display->mutex);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user