[PATCH wayland] client: prevent using and creating proxies after an error occured

Marek Chalupa mchqwerty at gmail.com
Fri Jul 18 08:56:36 PDT 2014


We won't receive any response anyway...

This removes the last line of:

[2230782.435] wl_display at 1.error(wl_display at 1, 2, "no memory")
wl_display at 1: error 2: no memory
[2230782.534]  -> wl_display at 1.sync(new id wl_callback at 3)

and prevents from creating proxy on invalidated display object.
---
 src/wayland-client.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/wayland-client.c b/src/wayland-client.c
index ee2215d..2f52900 100644
--- a/src/wayland-client.c
+++ b/src/wayland-client.c
@@ -312,6 +312,9 @@ wl_proxy_create(struct wl_proxy *factory, const struct wl_interface *interface)
 	struct wl_display *display = factory->display;
 	struct wl_proxy *proxy;
 
+	if (display->last_error)
+		return NULL;
+
 	pthread_mutex_lock(&display->mutex);
 	proxy = proxy_create(factory, interface);
 	pthread_mutex_unlock(&display->mutex);
@@ -523,6 +526,9 @@ wl_proxy_marshal_array_constructor(struct wl_proxy *proxy,
 	struct wl_proxy *new_proxy = NULL;
 	const struct wl_message *message;
 
+	if (proxy->display->last_error)
+		return NULL;
+
 	pthread_mutex_lock(&proxy->display->mutex);
 
 	message = &proxy->object.interface->methods[opcode];
-- 
2.0.1



More information about the wayland-devel mailing list