bool
wl_object_is_zombie(struct wl_map *map, uint32_t id)
{
- struct wl_object *object = wl_map_lookup(map, id);
+ uint32_t flags;
- return (object == WL_ZOMBIE_OBJECT);
+ /* Zombie objects only exist on the client side. */
+ if (map->side == WL_MAP_SERVER_SIDE)
+ return false;
+
+ /* Zombie objects can only have been created by the client. */
+ if (id >= WL_SERVER_ID_START)
+ return false;
+
+ flags = wl_map_lookup_flags(map, id);
+ return !!(flags & WL_MAP_ENTRY_ZOMBIE);
}
int
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;
* flags. If more flags are ever added, the implementation of wl_map will have
* to change to allow for new flags */
enum wl_map_entry_flags {
- WL_MAP_ENTRY_LEGACY = (1 << 0)
+ WL_MAP_ENTRY_LEGACY = (1 << 0), /* Server side only */
+ WL_MAP_ENTRY_ZOMBIE = (1 << 0) /* Client side only */
};
struct wl_map {