Skip to content

Commit

Permalink
surface: don't unref the current buffer on failure
Browse files Browse the repository at this point in the history
If wlr_buffer_create fails, keep the previous buffer.
  • Loading branch information
emersion authored and aiqs4 committed Dec 19, 2019
1 parent aa90f09 commit 77b7b51
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions types/wlr_surface.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit 77b7b51

Please sign in to comment.