client: Add WL_MAP_ENTRY_ZOMBIE flag

Add a new map entry flag to indicate that the object received is valid,
but a zombie. Previously this relied on a fixed object pointer, but
future patches in this series will have map entries returning either
NULL, or a different structure type entirely, for zombie objects.

wl_object_is_zombie() now solely uses the new flag to determine whether
or not the object is a zombie.

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

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
This commit is contained in:
Derek Foreman 2017-12-28 15:22:25 +00:00 committed by Daniel Stone
parent 69fab4fffc
commit 07d7a9968d
3 changed files with 21 additions and 9 deletions

View file

@ -405,15 +405,17 @@ wl_proxy_create_for_id(struct wl_proxy *factory,
static void
proxy_destroy(struct wl_proxy *proxy)
{
if (proxy->flags & WL_PROXY_FLAG_ID_DELETED)
if (proxy->flags & WL_PROXY_FLAG_ID_DELETED) {
wl_map_remove(&proxy->display->objects, proxy->object.id);
else if (proxy->object.id < WL_SERVER_ID_START)
wl_map_insert_at(&proxy->display->objects, 0,
proxy->object.id, WL_ZOMBIE_OBJECT);
else
} else if (proxy->object.id < WL_SERVER_ID_START) {
wl_map_insert_at(&proxy->display->objects,
WL_MAP_ENTRY_ZOMBIE,
proxy->object.id,
WL_ZOMBIE_OBJECT);
} else {
wl_map_insert_at(&proxy->display->objects, 0,
proxy->object.id, NULL);
}
proxy->flags |= WL_PROXY_FLAG_DESTROYED;