[PATCH wayland v4 03/11] client: Restructure delete_id handler control flow

Daniel Stone daniels at collabora.com
Thu Dec 28 19:53:49 UTC 2017


From: Derek Foreman <derekf at osg.samsung.com>

This makes it easier for future patches in the series, which can
possibly return NULL for extant map entries.

[daniels: Extracted from Derek's bespoke-zombie patch as an intermediate
          step.]

Reviewed-by: Daniel Stone <daniels at collabora.com>
Signed-off-by: Daniel Stone <daniels at collabora.com>
---
 src/wayland-client.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/src/wayland-client.c b/src/wayland-client.c
index 8fc56340..83f76ec2 100644
--- a/src/wayland-client.c
+++ b/src/wayland-client.c
@@ -836,13 +836,12 @@ display_handle_delete_id(void *data, struct wl_display *display, uint32_t id)
 
 	proxy = wl_map_lookup(&display->objects, id);
 
-	if (!proxy)
-		wl_log("error: received delete_id for unknown id (%u)\n", id);
-
-	if (proxy && !wl_object_is_zombie(&display->objects, id))
+	if (wl_object_is_zombie(&display->objects, id))
+		wl_map_remove(&display->objects, id);
+	else if (proxy)
 		proxy->flags |= WL_PROXY_FLAG_ID_DELETED;
 	else
-		wl_map_remove(&display->objects, id);
+		wl_log("error: received delete_id for unknown id (%u)\n", id);
 
 	pthread_mutex_unlock(&display->mutex);
 }
-- 
2.14.3



More information about the wayland-devel mailing list