summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDerek Foreman <derekf@osg.samsung.com>2017-01-24 12:07:20 -0600
committerPekka Paalanen <pekka.paalanen@collabora.co.uk>2017-01-25 14:59:02 +0200
commitefae9532e82e1faeb737fe0d3cf5932026ce1e6f (patch)
tree485bd1a537bd63d86de3682a2b773cf2456219a2
parent5fbc9daa409371d15ffb9012cc21dddc934fad4a (diff)
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>
-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 a981fda..0a5eacb 100644
--- a/src/wayland-server.c
+++ b/src/wayland-server.c
@@ -176,6 +176,9 @@ handle_array(struct wl_resource *resource, uint32_t opcode,
struct wl_closure *closure;
struct wl_object *object = &resource->object;
+ if (resource->client->error)
+ return;
+
closure = wl_closure_marshal(object, opcode, args,
&object->interface->events[opcode]);
@@ -249,8 +252,6 @@ wl_resource_post_error(struct wl_resource *resource,
vsnprintf(buffer, sizeof buffer, msg, ap);
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
@@ -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
* already dead client.
*/
- if (!client->display_resource)
+ if (client->error || !client->display_resource)
return;
wl_resource_post_event(client->display_resource,
WL_DISPLAY_ERROR, resource, code, buffer);
+ client->error = 1;
}
static int