mirror of
https://gitlab.freedesktop.org/wayland/wayland.git
synced 2026-03-28 07:58:44 -04:00
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: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
This commit is contained in:
parent
b4cf9e7d5e
commit
69fab4fffc
3 changed files with 14 additions and 3 deletions
|
|
@ -831,6 +831,14 @@ wl_connection_demarshal(struct wl_connection *connection,
|
||||||
return NULL;
|
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
|
int
|
||||||
wl_closure_lookup_objects(struct wl_closure *closure, struct wl_map *objects)
|
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;
|
closure->args[i].o = NULL;
|
||||||
|
|
||||||
object = wl_map_lookup(objects, id);
|
object = wl_map_lookup(objects, id);
|
||||||
if (object == WL_ZOMBIE_OBJECT) {
|
if (wl_object_is_zombie(objects, id)) {
|
||||||
/* references object we've already
|
/* references object we've already
|
||||||
* destroyed client side */
|
* destroyed client side */
|
||||||
object = NULL;
|
object = NULL;
|
||||||
|
|
|
||||||
|
|
@ -837,7 +837,7 @@ display_handle_delete_id(void *data, struct wl_display *display, uint32_t id)
|
||||||
if (!proxy)
|
if (!proxy)
|
||||||
wl_log("error: received delete_id for unknown id (%u)\n", id);
|
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;
|
proxy->flags |= WL_PROXY_FLAG_ID_DELETED;
|
||||||
else
|
else
|
||||||
wl_map_remove(&display->objects, id);
|
wl_map_remove(&display->objects, id);
|
||||||
|
|
@ -1253,7 +1253,7 @@ queue_event(struct wl_display *display, int len)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
proxy = wl_map_lookup(&display->objects, id);
|
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);
|
wl_connection_consume(display->connection, size);
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -190,6 +190,9 @@ wl_connection_demarshal(struct wl_connection *connection,
|
||||||
struct wl_map *objects,
|
struct wl_map *objects,
|
||||||
const struct wl_message *message);
|
const struct wl_message *message);
|
||||||
|
|
||||||
|
bool
|
||||||
|
wl_object_is_zombie(struct wl_map *map, uint32_t id);
|
||||||
|
|
||||||
int
|
int
|
||||||
wl_closure_lookup_objects(struct wl_closure *closure, struct wl_map *objects);
|
wl_closure_lookup_objects(struct wl_closure *closure, struct wl_map *objects);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue