summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKristian Høgsberg <krh@bitplanet.net>2012-01-04 09:13:27 -0500
committerKristian Høgsberg <krh@bitplanet.net>2012-01-04 09:13:27 -0500
commit44b529f2e4b953206908f73842ca76d246f715d0 (patch)
treed61d99e5301872645f6ac7487576dd22552f34c9 /src
parentc7473897fc6175b2a1a4af673c7ba489483a1cbb (diff)
server: Allocate server ID for when resource->object.id is 0
Diffstat (limited to 'src')
-rw-r--r--src/wayland-server.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/wayland-server.c b/src/wayland-server.c
index 1e97e7b..0cd8b74 100644
--- a/src/wayland-server.c
+++ b/src/wayland-server.c
@@ -322,9 +322,16 @@ WL_EXPORT void
wl_client_add_resource(struct wl_client *client,
struct wl_resource *resource)
{
+ if (resource->object.id == 0)
+ resource->object.id =
+ wl_map_insert_new(&client->objects,
+ WL_MAP_SERVER_SIDE, resource);
+ else
+ wl_map_insert_at(&client->objects,
+ resource->object.id, resource);
+
resource->client = client;
wl_list_init(&resource->destroy_listener_list);
- wl_map_insert_at(&client->objects, resource->object.id, resource);
}
WL_EXPORT void