Commit 69fab4ff authored by Derek Foreman's avatar Derek Foreman Committed by Daniel Stone

client: Add wl_object_is_zombie() helper function

Add a helper function which determines whether or not an object is a
zombie.

[daniels: Extracted from Derek's bespoke-zombie patch as an intermediate
          step.]
Signed-off-by: default avatarDerek Foreman <derekf@osg.samsung.com>
Reviewed-by: Daniel Stone's avatarDaniel Stone <daniels@collabora.com>
parent b4cf9e7d
......@@ -831,6 +831,14 @@ wl_connection_demarshal(struct wl_connection *connection,
return NULL;
}
bool
wl_object_is_zombie(struct wl_map *map, uint32_t id)
{
struct wl_object *object = wl_map_lookup(map, id);
return (object == WL_ZOMBIE_OBJECT);
}
int
wl_closure_lookup_objects(struct wl_closure *closure, struct wl_map *objects)
{
......@@ -852,7 +860,7 @@ wl_closure_lookup_objects(struct wl_closure *closure, struct wl_map *objects)
closure->args[i].o = NULL;
object = wl_map_lookup(objects, id);
if (object == WL_ZOMBIE_OBJECT) {
if (wl_object_is_zombie(objects, id)) {
/* references object we've already
* destroyed client side */
object = NULL;
......
......@@ -837,7 +837,7 @@ display_handle_delete_id(void *data, struct wl_display *display, uint32_t id)
if (!proxy)
wl_log("error: received delete_id for unknown id (%u)\n", id);
if (proxy && proxy != WL_ZOMBIE_OBJECT)
if (proxy && !wl_object_is_zombie(&display->objects, id))
proxy->flags |= WL_PROXY_FLAG_ID_DELETED;
else
wl_map_remove(&display->objects, id);
......@@ -1253,7 +1253,7 @@ queue_event(struct wl_display *display, int len)
return 0;
proxy = wl_map_lookup(&display->objects, id);
if (!proxy || proxy == WL_ZOMBIE_OBJECT) {
if (!proxy || wl_object_is_zombie(&display->objects, id)) {
wl_connection_consume(display->connection, size);
return size;
}
......
......@@ -190,6 +190,9 @@ wl_connection_demarshal(struct wl_connection *connection,
struct wl_map *objects,
const struct wl_message *message);
bool
wl_object_is_zombie(struct wl_map *map, uint32_t id);
int
wl_closure_lookup_objects(struct wl_closure *closure, struct wl_map *objects);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment