summaryrefslogtreecommitdiff
path: root/kiosk-shell
diff options
context:
space:
mode:
authorMarius Vlad <marius.vlad@collabora.com>2021-12-17 11:07:25 +0200
committerMarius Vlad <marius.vlad@collabora.com>2021-12-17 11:08:26 +0200
commitc3f7a496a6495cbe30de2ecc8ce566d223faf76c (patch)
tree5b6f74cc3b9aec14bc51837309a06b9a2c2c60c1 /kiosk-shell
parentd25d63e692bda225144a2548ff9df8ee0f4c50a1 (diff)
downloadweston-c3f7a496a6495cbe30de2ecc8ce566d223faf76c.tar.gz
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>
Diffstat (limited to 'kiosk-shell')
-rw-r--r--kiosk-shell/kiosk-shell.c26
1 files changed, 22 insertions, 4 deletions
diff --git a/kiosk-shell/kiosk-shell.c b/kiosk-shell/kiosk-shell.c
index 45e83536..5995baea 100644
--- a/kiosk-shell/kiosk-shell.c
+++ b/kiosk-shell/kiosk-shell.c
@@ -1096,6 +1096,21 @@ kiosk_shell_handle_seat_created(struct wl_listener *listener, void *data)
}
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)
{
struct kiosk_shell *shell =
@@ -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);
}