Destroy wlr_buffer only on quit or error in wlr_screencast.c

This commit is contained in:
columbarius 2020-08-04 02:32:53 +02:00 committed by Simon Ser
parent 68f9759a78
commit e57beee43d
1 changed files with 5 additions and 3 deletions

View File

@ -25,9 +25,11 @@ void xdpw_wlr_frame_free(struct xdpw_screencast_instance *cast) {
munmap(cast->simple_frame.data, cast->simple_frame.size);
cast->simple_frame.data = NULL;
// TODO: reuse this buffer unless we quit or error out
wl_buffer_destroy(cast->simple_frame.buffer);
cast->simple_frame.buffer = NULL;
logprint(TRACE, "wlroots: frame destroyed");
if (cast->quit || cast->err) {
wl_buffer_destroy(cast->simple_frame.buffer);
cast->simple_frame.buffer = NULL;
logprint(TRACE, "wlroots: frame destroyed");
}
if (cast->quit || cast->err) {
// TODO: revisit the exit condition (remove quit?)