From 2699b68b34520a7efd0927ec9f186ecb39488946 Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Sun, 28 Dec 2025 20:12:04 +0100 Subject: [PATCH] ext_image_capture_source_v1/scene: fix stop for parallel captures The stop handler disables the output. However, the same source can be captured multiple times in parallel. In that case, stop might be called while another capture session is still ongoing. Only disable the output if the last session is stopped. --- types/ext_image_capture_source_v1/scene.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/types/ext_image_capture_source_v1/scene.c b/types/ext_image_capture_source_v1/scene.c index a8bce9d3d..b1e46dcad 100644 --- a/types/ext_image_capture_source_v1/scene.c +++ b/types/ext_image_capture_source_v1/scene.c @@ -20,6 +20,7 @@ struct scene_node_source { struct wlr_scene_output *scene_output; struct wl_event_source *idle_frame; + size_t num_started; struct wl_listener node_destroy; struct wl_listener scene_output_destroy; @@ -103,12 +104,23 @@ static void source_render(struct scene_node_source *source) { static void source_start(struct wlr_ext_image_capture_source_v1 *base, bool with_cursors) { struct scene_node_source *source = wl_container_of(base, source, base); + + source->num_started++; + if (source->num_started > 1) { + return; + } + source_render(source); } static void source_stop(struct wlr_ext_image_capture_source_v1 *base) { struct scene_node_source *source = wl_container_of(base, source, base); + source->num_started--; + if (source->num_started > 0) { + return; + } + struct wlr_output_state state; wlr_output_state_init(&state); wlr_output_state_set_enabled(&state, false);