kaboom: detach buffer from scene before freeing pixel data

Call wlr_scene_buffer_set_buffer(NULL) before destroying the tree
and freeing the pixman images to prevent the scene graph from
accessing freed memory during its next render pass.
This commit is contained in:
lkn 2026-06-23 20:32:28 +02:00
parent ac74064d1c
commit c2c3bca41b
1 changed files with 5 additions and 2 deletions

View File

@ -48,12 +48,15 @@ static void kaboom_destroy(struct kaboom_state *state)
{
if (state->timer)
wl_event_source_remove(state->timer);
/* Detach buffer from scene before freeing pixel data */
if (state->scene_buf)
wlr_scene_buffer_set_buffer(state->scene_buf, NULL);
if (state->tree)
wlr_scene_node_destroy(&state->tree->node);
if (state->image)
pixman_image_unref(state->image);
if (state->src_image)
pixman_image_unref(state->src_image);
if (state->image)
pixman_image_unref(state->image);
wlr_buffer_drop(&state->base);
free(state->pieces);
free(state);