diff options
author | Simon Ser <contact@emersion.fr> | 2019-12-12 19:06:34 +0100 |
---|---|---|
committer | Drew DeVault <sir@cmpwn.com> | 2019-12-14 09:19:44 -0500 |
commit | 96e8e9b098e4828935a5d6b149e63e819cc86482 (patch) | |
tree | 2d0c4fe95c51a314421ee1213b02b99577c92f3c | |
parent | efd294ef09e95870b72d7b1903d39221a2aecc11 (diff) |
buffer: improve error handling
In case the texture can't be imported, release the buffer so that the
client can submit another one. In case the allocation fails, disconnect
the client.
-rw-r--r-- | types/wlr_buffer.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/types/wlr_buffer.c b/types/wlr_buffer.c index 9d079b9a..1a95bcc2 100644 --- a/types/wlr_buffer.c +++ b/types/wlr_buffer.c @@ -96,12 +96,14 @@ struct wlr_buffer *wlr_buffer_create(struct wlr_renderer *renderer, if (texture == NULL) { wlr_log(WLR_ERROR, "Failed to upload texture"); + wl_buffer_send_release(resource); return NULL; } struct wlr_buffer *buffer = calloc(1, sizeof(struct wlr_buffer)); if (buffer == NULL) { wlr_texture_destroy(texture); + wl_resource_post_no_memory(resource); return NULL; } buffer->resource = resource; |