surface: Ensure view is unmapped before destroy signal

When the destroy signal is fired, child views will disassociate
themselves from the parent. This means that we can no longer see what
the child views are - and that recursive unmapping does not work.

Make sure that views are fully unmapped before anything else happens in
destroy, so we can recursively unmap child views.

Signed-off-by: Daniel Stone <daniels@collabora.com>
This commit is contained in:
Daniel Stone 2023-06-22 17:20:42 +01:00
parent 0189bfac9f
commit 0ff72e5374
1 changed files with 6 additions and 5 deletions

View File

@ -2156,16 +2156,15 @@ WL_EXPORT void
weston_view_destroy(struct weston_view *view)
{
struct weston_paint_node *pnode, *pntmp;
struct weston_compositor *compositor = view->surface->compositor;
if (weston_view_is_mapped(view))
weston_view_unmap(view);
weston_signal_emit_mutable(&view->destroy_signal, view);
assert(wl_list_empty(&view->geometry.child_list));
if (weston_view_is_mapped(view)) {
weston_view_unmap(view);
weston_compositor_build_view_list(view->surface->compositor);
}
wl_list_for_each_safe(pnode, pntmp, &view->paint_node_list, view_link)
weston_paint_node_destroy(pnode);
@ -2183,6 +2182,8 @@ weston_view_destroy(struct weston_view *view)
wl_list_remove(&view->surface_link);
free(view);
weston_compositor_build_view_list(compositor);
}
WL_EXPORT struct weston_surface *