[PATCH] client: check for error before prepare/read

Marek Chalupa mchqwerty at gmail.com
Tue Aug 5 02:43:35 PDT 2014


This prevents from blocking shown in one display test. Also, it
makes sense to not proceed further in the code of these function
when an error occurred.
---
 src/wayland-client.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/wayland-client.c b/src/wayland-client.c
index 68a91f6..f176dd4 100644
--- a/src/wayland-client.c
+++ b/src/wayland-client.c
@@ -1183,6 +1183,9 @@ wl_display_read_events(struct wl_display *display)
 {
 	int ret;
 
+	if (display->last_error)
+		return -1;
+
 	pthread_mutex_lock(&display->mutex);
 
 	ret = read_events(display);
@@ -1229,6 +1232,9 @@ wl_display_prepare_read_queue(struct wl_display *display,
 {
 	int ret;
 
+	if (display->last_error)
+		return -1;
+
 	pthread_mutex_lock(&display->mutex);
 
 	if (!wl_list_empty(&queue->event_list)) {
-- 
2.0.4



More information about the wayland-devel mailing list