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

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); munmap(cast->simple_frame.data, cast->simple_frame.size);
cast->simple_frame.data = NULL; cast->simple_frame.data = NULL;
// TODO: reuse this buffer unless we quit or error out // TODO: reuse this buffer unless we quit or error out
wl_buffer_destroy(cast->simple_frame.buffer); if (cast->quit || cast->err) {
cast->simple_frame.buffer = NULL; wl_buffer_destroy(cast->simple_frame.buffer);
logprint(TRACE, "wlroots: frame destroyed"); cast->simple_frame.buffer = NULL;
logprint(TRACE, "wlroots: frame destroyed");
}
if (cast->quit || cast->err) { if (cast->quit || cast->err) {
// TODO: revisit the exit condition (remove quit?) // TODO: revisit the exit condition (remove quit?)