From 3cb2cf9425a35333661b1edcc0d34e92ea109fd3 Mon Sep 17 00:00:00 2001 From: llyyr Date: Fri, 13 Mar 2026 23:32:06 +0530 Subject: [PATCH] scene: use wl_list_for_each_safe to iterate outputs The outputs loop in handle_scene_buffer_outputs_update may remove entries from the list while iterating, so use wl_list_for_each_safe instead of wl_list_for_each. Fixes: 39e918edc893 ("scene: avoid redundant wl_surface.enter/leave events") --- types/scene/surface.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/scene/surface.c b/types/scene/surface.c index c7a53a1b3..7aa75c6d4 100644 --- a/types/scene/surface.c +++ b/types/scene/surface.c @@ -112,8 +112,8 @@ static void handle_scene_buffer_outputs_update( // 2. When a surface transitions from being visible on 0 outputs to being visible on >0 outputs // send leave events for all entered outputs on which the surface is no longer visible as // well as enter events for any outputs not already entered. - struct wlr_surface_output *entered_output; - wl_list_for_each(entered_output, &surface->surface->current_outputs, link) { + struct wlr_surface_output *entered_output, *tmp; + wl_list_for_each_safe(entered_output, tmp, &surface->surface->current_outputs, link) { bool active = false; for (size_t i = 0; i < event->size; i++) { if (entered_output->output == event->active[i]->output) {