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 <m.olbrich@pengutronix.de>
This commit is contained in:
Michael Olbrich 2025-02-11 16:37:38 +01:00 committed by Marius Vlad
parent 94dd926b99
commit 6e88a851a4

View file

@ -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);