summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPekka Paalanen <ppaalanen@gmail.com>2011-11-29 14:32:32 +0200
committerPekka Paalanen <ppaalanen@gmail.com>2011-11-29 14:46:49 +0200
commitcf89b40c4ca105416240df737ba8e30c070a44af (patch)
tree46268d8c0b77c4443a488fcd96a09a063c2565d0
parent42eed3235a8349ac2139bb9a06cb8ac294872809 (diff)
server: do not send delete_id to a dead client
During client tear-down, all objects are destroyed in id order. Therefore the display object is destroyed first. If the destroy listeners of any object destroy another object by calling wl_resoruce_destroy(), we try to send a delete_id event to the client. This leads to a segmentation fault without a display object. Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
-rw-r--r--src/wayland-server.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/wayland-server.c b/src/wayland-server.c
index 9358eb4..421c3f0 100644
--- a/src/wayland-server.c
+++ b/src/wayland-server.c
@@ -348,9 +348,11 @@ wl_resource_destroy(struct wl_resource *resource, uint32_t time)
struct wl_client *client = resource->client;
if (resource->object.id < WL_SERVER_ID_START) {
- wl_resource_queue_event(resource->client->display_resource,
- WL_DISPLAY_DELETE_ID,
- resource->object.id);
+ if (client->display_resource) {
+ wl_resource_queue_event(client->display_resource,
+ WL_DISPLAY_DELETE_ID,
+ resource->object.id);
+ }
wl_map_insert_at(&client->objects, resource->object.id, NULL);
} else {
wl_map_remove(&client->objects, resource->object.id);