kiosk-shell: Do not leave views on layers on shell destroy

Nothing special, but avoids hitting the warning about
terminating/finishing a layer with views on it.

Fixes #509.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
This commit is contained in:
Marius Vlad 2021-12-17 11:07:25 +02:00
parent d25d63e692
commit c3f7a496a6

View file

@ -1095,6 +1095,21 @@ kiosk_shell_handle_seat_created(struct wl_listener *listener, void *data)
kiosk_shell_seat_create(shell, seat);
}
static void
kiosk_shell_destroy_surfaces_on_layer(struct weston_layer *layer)
{
struct weston_view *view, *view_next;
wl_list_for_each_safe(view, view_next, &layer->view_list.link, layer_link.link) {
struct kiosk_shell_surface *shsurf =
get_kiosk_shell_surface(view->surface);
assert(shsurf);
kiosk_shell_surface_destroy(shsurf);
}
weston_layer_fini(layer);
}
static void
kiosk_shell_destroy(struct wl_listener *listener, void *data)
{
@ -1114,16 +1129,19 @@ kiosk_shell_destroy(struct wl_listener *listener, void *data)
kiosk_shell_output_destroy(shoutput);
}
/* bg layer doesn't contain a weston_desktop_surface, and
* kiosk_shell_output_destroy() takes care of destroying it, we're just
* doing a weston_layer_fini() here as there might be multiple bg views */
weston_layer_fini(&shell->background_layer);
kiosk_shell_destroy_surfaces_on_layer(&shell->normal_layer);
kiosk_shell_destroy_surfaces_on_layer(&shell->inactive_layer);
wl_list_for_each_safe(shseat, shseat_next, &shell->seat_list, link) {
kiosk_shell_seat_destroy(shseat);
}
weston_desktop_destroy(shell->desktop);
weston_layer_fini(&shell->background_layer);
weston_layer_fini(&shell->normal_layer);
weston_layer_fini(&shell->inactive_layer);
free(shell);
}