diff options
author | Simon Ser <contact@emersion.fr> | 2019-12-12 19:12:08 +0100 |
---|---|---|
committer | Drew DeVault <sir@cmpwn.com> | 2019-12-14 09:19:44 -0500 |
commit | 7fc58e704a36c4a2b30ddf2f8e0ab935b4f10b96 (patch) | |
tree | cf93cfa9c540df7c78d06103e685f7e3321a26b9 | |
parent | 96e8e9b098e4828935a5d6b149e63e819cc86482 (diff) |
surface: don't unref the current buffer on failure
If wlr_buffer_create fails, keep the previous buffer.
-rw-r--r-- | types/wlr_surface.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/types/wlr_surface.c b/types/wlr_surface.c index 9503b8d4..f44ec53e 100644 --- a/types/wlr_surface.c +++ b/types/wlr_surface.c @@ -296,15 +296,13 @@ static void surface_apply_damage(struct wlr_surface *surface) { } } - wlr_buffer_unref(surface->buffer); - surface->buffer = NULL; - struct wlr_buffer *buffer = wlr_buffer_create(surface->renderer, resource); if (buffer == NULL) { wlr_log(WLR_ERROR, "Failed to upload buffer"); return; } + wlr_buffer_unref(surface->buffer); surface->buffer = buffer; } |