From c3acef0dc01dd69fbcd59252636f9437912ab3fd Mon Sep 17 00:00:00 2001 From: Kenny Levinsen Date: Sun, 10 Nov 2024 00:22:17 +0100 Subject: [PATCH] scene: Only unwrap client buffer when underlying buffer is held Client buffers backed by wl_shm is aggressively released, in which case we are not allowed to access it. Locking an already released buffer and later unlocking it will also re-trigger release, confusing clients. As a quick workaround, guard the unwrap by checking if the buffer is locked, which will be the case for non-wl_shm buffers. --- types/scene/wlr_scene.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/scene/wlr_scene.c b/types/scene/wlr_scene.c index 370be2b3a..6d14299ca 100644 --- a/types/scene/wlr_scene.c +++ b/types/scene/wlr_scene.c @@ -1874,7 +1874,7 @@ static bool scene_entry_try_direct_scanout(struct render_list_entry *entry, struct wlr_buffer *wlr_buffer = buffer->buffer; struct wlr_client_buffer *client_buffer = wlr_client_buffer_get(wlr_buffer); - if (client_buffer != NULL && client_buffer->source != NULL) { + if (client_buffer != NULL && client_buffer->source != NULL && client_buffer->source->n_locks > 0) { wlr_buffer = client_buffer->source; }