summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKristian Høgsberg <krh@bitplanet.net>2012-03-01 22:46:07 -0500
committerKristian Høgsberg <krh@bitplanet.net>2012-03-01 22:46:46 -0500
commit0d22d25b8740688a4f243c70cdfd32bc05993778 (patch)
treecc395db46eba8b1dac05d15e587250583e1a873c
parente7f6c509e2bc6437c858f95b37effee619bdfe17 (diff)
wayland-server: Destroy resource before sending out delete_id event
In some cases, we send out events from the resource destructor and those need to go out before we recycle the object ID.
-rw-r--r--src/wayland-server.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/wayland-server.c b/src/wayland-server.c
index c70e411..6a8cbcb 100644
--- a/src/wayland-server.c
+++ b/src/wayland-server.c
@@ -393,19 +393,20 @@ WL_EXPORT void
wl_resource_destroy(struct wl_resource *resource, uint32_t time)
{
struct wl_client *client = resource->client;
+ uint32_t id;
+
+ id = resource->object.id;
+ destroy_resource(resource, &time);
- if (resource->object.id < WL_SERVER_ID_START) {
+ if (id < WL_SERVER_ID_START) {
if (client->display_resource) {
wl_resource_queue_event(client->display_resource,
- WL_DISPLAY_DELETE_ID,
- resource->object.id);
+ WL_DISPLAY_DELETE_ID, id);
}
- wl_map_insert_at(&client->objects, resource->object.id, NULL);
+ wl_map_insert_at(&client->objects, id, NULL);
} else {
- wl_map_remove(&client->objects, resource->object.id);
+ wl_map_remove(&client->objects, id);
}
-
- destroy_resource(resource, &time);
}
WL_EXPORT void