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.
This commit is contained in:
Kenny Levinsen 2024-11-10 00:22:17 +01:00
parent f440c60128
commit c3acef0dc0

View File

@ -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_buffer *wlr_buffer = buffer->buffer;
struct wlr_client_buffer *client_buffer = wlr_client_buffer_get(wlr_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; wlr_buffer = client_buffer->source;
} }