Until now, we haven't done anything to prevent sending additional
events to clients after posting an error.

Acked-by: Daniel Stone <[email protected]>
Signed-off-by: Derek Foreman <[email protected]>
---
 src/wayland-server.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/wayland-server.c b/src/wayland-server.c
index 3f252aa..7e26aa0 100644
--- a/src/wayland-server.c
+++ b/src/wayland-server.c
@@ -171,6 +171,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]);
 
@@ -244,8 +247,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
@@ -253,11 +254,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
-- 
2.11.0

_______________________________________________
wayland-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/wayland-devel

Reply via email to