mirror of
https://gitlab.freedesktop.org/wayland/wayland.git
synced 2025-11-04 13:29:51 -05:00
server: no errors to a dead client
Do not try to send errors to an already dead client, while in the middle of cleanup. Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
This commit is contained in:
parent
eae3bcb4cc
commit
ab6b0738c6
1 changed files with 19 additions and 0 deletions
|
|
@ -143,6 +143,17 @@ wl_resource_post_error(struct wl_resource *resource,
|
|||
va_end(ap);
|
||||
|
||||
client->error = 1;
|
||||
|
||||
/*
|
||||
* When a client aborts, its resources are destroyed in id order,
|
||||
* which means the display resource is destroyed first. If destruction
|
||||
* of any later resources results in a protocol error, we end up here
|
||||
* with a NULL display_resource. Do not try to send errors to an
|
||||
* already dead client.
|
||||
*/
|
||||
if (!client->display_resource)
|
||||
return;
|
||||
|
||||
wl_resource_post_event(client->display_resource,
|
||||
WL_DISPLAY_ERROR, resource, code, buffer);
|
||||
}
|
||||
|
|
@ -578,6 +589,13 @@ struct wl_display_interface display_interface = {
|
|||
display_sync,
|
||||
};
|
||||
|
||||
static void
|
||||
destroy_client_display_resource(struct wl_resource *resource)
|
||||
{
|
||||
resource->client->display_resource = NULL;
|
||||
free(resource);
|
||||
}
|
||||
|
||||
static void
|
||||
bind_display(struct wl_client *client,
|
||||
void *data, uint32_t version, uint32_t id)
|
||||
|
|
@ -588,6 +606,7 @@ bind_display(struct wl_client *client,
|
|||
client->display_resource =
|
||||
wl_client_add_object(client, &wl_display_interface,
|
||||
&display_interface, id, display);
|
||||
client->display_resource->destroy = destroy_client_display_resource;
|
||||
|
||||
wl_list_for_each(global, &display->global_list, link)
|
||||
wl_resource_post_event(client->display_resource,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue