From 6e88a851a4658afca34ccb2d22d55448a58671bc Mon Sep 17 00:00:00 2001 From: Michael Olbrich Date: Tue, 11 Feb 2025 16:37:38 +0100 Subject: [PATCH] libweston-desktop: don't try to move child surfaces to not existing layer The parent surface may not be on a layer. In that case, remove all child surfaces from their current layer as well. Signed-off-by: Michael Olbrich --- libweston/desktop/surface.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/libweston/desktop/surface.c b/libweston/desktop/surface.c index 28ef55cbe..7535e1bec 100644 --- a/libweston/desktop/surface.c +++ b/libweston/desktop/surface.c @@ -456,8 +456,12 @@ weston_desktop_view_propagate_layer(struct weston_desktop_view *view) /* Move each child to the same layer, immediately in front of its * parent. */ wl_list_for_each_reverse(child, &view->children_list, children_link) { - struct weston_layer_entry *child_pos = - wl_container_of(parent_pos->prev, child_pos, link); + struct weston_layer_entry *child_pos; + + if (view->view->layer_link.layer) + child_pos = wl_container_of(parent_pos->prev, child_pos, link); + else + child_pos = NULL; weston_view_move_to_layer(child->view, child_pos); weston_desktop_view_propagate_layer(child);