mirror of
https://gitlab.freedesktop.org/wayland/wayland.git
synced 2025-10-31 22:25:25 -04:00
server: Handle OOM properly when we fail to allocate a send closure
If we can't allocate a closure, don't just silently continue. Set client->error so we shut down the client when we're done processing events.
This commit is contained in:
parent
c1fd097cd9
commit
1b0cabfc48
1 changed files with 6 additions and 2 deletions
|
|
@ -136,8 +136,10 @@ wl_resource_post_event(struct wl_resource *resource, uint32_t opcode, ...)
|
||||||
&object->interface->events[opcode]);
|
&object->interface->events[opcode]);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
|
|
||||||
if (closure == NULL)
|
if (closure == NULL) {
|
||||||
|
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,
|
wl_event_loop_add_idle(resource->client->display->loop,
|
||||||
|
|
@ -162,8 +164,10 @@ wl_resource_queue_event(struct wl_resource *resource, uint32_t opcode, ...)
|
||||||
&object->interface->events[opcode]);
|
&object->interface->events[opcode]);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
|
|
||||||
if (closure == NULL)
|
if (closure == NULL) {
|
||||||
|
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,
|
wl_event_loop_add_idle(resource->client->display->loop,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue