mirror of
https://gitlab.freedesktop.org/wayland/wayland.git
synced 2025-10-31 22:25:25 -04:00
server: Set client->error when we fail to send a closure
We we're using wl_event_loop_add_idle() here, but if we're failing because of OOM, that will typically also fail. Instead, use the existing client->error flag, which will break out of the event handling loop and shut down the client.
This commit is contained in:
parent
c0eb45286c
commit
7db9d248ce
1 changed files with 4 additions and 14 deletions
|
|
@ -116,14 +116,6 @@ struct wl_resource {
|
||||||
|
|
||||||
static int wl_debug = 0;
|
static int wl_debug = 0;
|
||||||
|
|
||||||
static void
|
|
||||||
destroy_client(void *data)
|
|
||||||
{
|
|
||||||
struct wl_client *client = data;
|
|
||||||
|
|
||||||
wl_client_destroy(client);
|
|
||||||
}
|
|
||||||
|
|
||||||
WL_EXPORT void
|
WL_EXPORT void
|
||||||
wl_resource_post_event(struct wl_resource *resource, uint32_t opcode, ...)
|
wl_resource_post_event(struct wl_resource *resource, uint32_t opcode, ...)
|
||||||
{
|
{
|
||||||
|
|
@ -137,13 +129,12 @@ wl_resource_post_event(struct wl_resource *resource, uint32_t opcode, ...)
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
|
|
||||||
if (closure == NULL) {
|
if (closure == NULL) {
|
||||||
resource->client->error = 1
|
resource->client->error = 1;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (wl_closure_send(closure, resource->client->connection))
|
if (wl_closure_send(closure, resource->client->connection))
|
||||||
wl_event_loop_add_idle(resource->client->display->loop,
|
resource->client->error = 1;
|
||||||
destroy_client, resource->client);
|
|
||||||
|
|
||||||
if (wl_debug)
|
if (wl_debug)
|
||||||
wl_closure_print(closure, object, true);
|
wl_closure_print(closure, object, true);
|
||||||
|
|
@ -165,13 +156,12 @@ wl_resource_queue_event(struct wl_resource *resource, uint32_t opcode, ...)
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
|
|
||||||
if (closure == NULL) {
|
if (closure == NULL) {
|
||||||
resource->client->error = 1
|
resource->client->error = 1;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (wl_closure_queue(closure, resource->client->connection))
|
if (wl_closure_queue(closure, resource->client->connection))
|
||||||
wl_event_loop_add_idle(resource->client->display->loop,
|
resource->client->error = 1;
|
||||||
destroy_client, resource->client);
|
|
||||||
|
|
||||||
if (wl_debug)
|
if (wl_debug)
|
||||||
wl_closure_print(closure, object, true);
|
wl_closure_print(closure, object, true);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue