From 2aebb8e444d4d063337f5e87195f06164d8dce5b Mon Sep 17 00:00:00 2001 From: Alexander Orzechowski Date: Tue, 12 Mar 2024 11:27:24 -0400 Subject: [PATCH] wlr_scene: Fix crash when committing NULL buffer If we commit a null buffer, we want to avoid the buffer damage path and instead just update the node to avoid it. --- types/scene/wlr_scene.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/types/scene/wlr_scene.c b/types/scene/wlr_scene.c index 252eed3f..858d5a54 100644 --- a/types/scene/wlr_scene.c +++ b/types/scene/wlr_scene.c @@ -669,6 +669,11 @@ void wlr_scene_buffer_set_buffer_with_damage(struct wlr_scene_buffer *scene_buff bool mapped = buffer != NULL; bool prev_mapped = scene_buffer->buffer != NULL || scene_buffer->texture != NULL; + if (!mapped && !prev_mapped) { + // unmapping already unmapped buffer - noop + return; + } + // if this node used to not be mapped or its previous displayed // buffer region will be different from what the new buffer would // produce we need to update the node.