From: Marek Chalupa Date: Wed, 10 Sep 2014 10:47:14 +0000 (+0200) Subject: client: cancel read in wl_display_read_events() when last_error is set X-Git-Tag: 1.5.93~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=083d8da432b2052db78f0a19405275c2b4391b5a;p=platform%2Fupstream%2Fwayland.git 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 for pointing that out. Signed-off-by: Marek Chalupa Reviewed-by: Pekka Paalanen --- diff --git a/src/wayland-client.c b/src/wayland-client.c index 1b7a046..b0f77b9 100644 --- a/src/wayland-client.c +++ b/src/wayland-client.c @@ -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); }