mirror of
https://gitlab.freedesktop.org/wayland/wayland.git
synced 2025-11-03 09:01:42 -05:00
server: Disallow sending events to clients after posting an error
Until now, we haven't done anything to prevent sending additional events to clients after posting an error. Acked-by: Daniel Stone <daniels@collabora.com> Signed-off-by: Derek Foreman <derekf@osg.samsung.com> Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
This commit is contained in:
parent
5fbc9daa40
commit
efae9532e8
1 changed files with 5 additions and 3 deletions
|
|
@ -176,6 +176,9 @@ handle_array(struct wl_resource *resource, uint32_t opcode,
|
||||||
struct wl_closure *closure;
|
struct wl_closure *closure;
|
||||||
struct wl_object *object = &resource->object;
|
struct wl_object *object = &resource->object;
|
||||||
|
|
||||||
|
if (resource->client->error)
|
||||||
|
return;
|
||||||
|
|
||||||
closure = wl_closure_marshal(object, opcode, args,
|
closure = wl_closure_marshal(object, opcode, args,
|
||||||
&object->interface->events[opcode]);
|
&object->interface->events[opcode]);
|
||||||
|
|
||||||
|
|
@ -249,8 +252,6 @@ wl_resource_post_error(struct wl_resource *resource,
|
||||||
vsnprintf(buffer, sizeof buffer, msg, ap);
|
vsnprintf(buffer, sizeof buffer, msg, ap);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
|
|
||||||
client->error = 1;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* When a client aborts, its resources are destroyed in id order,
|
* When a client aborts, its resources are destroyed in id order,
|
||||||
* which means the display resource is destroyed first. If destruction
|
* which means the display resource is destroyed first. If destruction
|
||||||
|
|
@ -258,11 +259,12 @@ wl_resource_post_error(struct wl_resource *resource,
|
||||||
* with a NULL display_resource. Do not try to send errors to an
|
* with a NULL display_resource. Do not try to send errors to an
|
||||||
* already dead client.
|
* already dead client.
|
||||||
*/
|
*/
|
||||||
if (!client->display_resource)
|
if (client->error || !client->display_resource)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
wl_resource_post_event(client->display_resource,
|
wl_resource_post_event(client->display_resource,
|
||||||
WL_DISPLAY_ERROR, resource, code, buffer);
|
WL_DISPLAY_ERROR, resource, code, buffer);
|
||||||
|
client->error = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue