summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarius Vlad <marius.vlad@collabora.com>2022-05-03 18:04:14 +0300
committerMarius Vlad <marius.vlad@collabora.com>2022-05-03 18:17:26 +0300
commit71deafe03f41738bfcd7eafd21c3262c29f45ee7 (patch)
treef7e601e96eb19b8dc3775aaf13689431a6a65b6e
parent41791c9fa1839e93a65b262524798aa9689c4ffc (diff)
shell: Added missing layer fini calls
Newer libweston version introduced additional API to determine if we are missing out proper destruction paths. Bug-AGL: SPEC-4351 Signed-off-by: Marius Vlad <marius.vlad@collabora.com> Change-Id: I135ca463992244ae91512854c7da7004de48f72e
-rw-r--r--src/desktop.c4
-rw-r--r--src/ivi-compositor.h3
-rw-r--r--src/shell.c71
3 files changed, 77 insertions, 1 deletions
diff --git a/src/desktop.c b/src/desktop.c
index 28ef52b..bc1e33f 100644
--- a/src/desktop.c
+++ b/src/desktop.c
@@ -449,8 +449,10 @@ ivi_shell_destroy(struct wl_listener *listener, void *data)
struct ivi_compositor *ivi = container_of(listener,
struct ivi_compositor, destroy_listener);
- weston_desktop_destroy(ivi->desktop);
+ ivi_shell_finalize(ivi);
ivi_compositor_destroy_pending_surfaces(ivi);
+
+ weston_desktop_destroy(ivi->desktop);
wl_list_remove(&listener->link);
}
diff --git a/src/ivi-compositor.h b/src/ivi-compositor.h
index 9aadd62..3d853e2 100644
--- a/src/ivi-compositor.h
+++ b/src/ivi-compositor.h
@@ -437,4 +437,7 @@ ivi_layout_find_bg_output(struct ivi_compositor *ivi);
void
ivi_compositor_destroy_pending_surfaces(struct ivi_compositor *ivi);
+void
+ivi_shell_finalize(struct ivi_compositor *ivi);
+
#endif
diff --git a/src/shell.c b/src/shell.c
index 6ec444a..efcb102 100644
--- a/src/shell.c
+++ b/src/shell.c
@@ -49,6 +49,18 @@
static void
create_black_surface_view(struct ivi_output *output);
+static struct ivi_surface *
+get_ivi_shell_surface(struct weston_surface *wsurface)
+{
+ if (weston_surface_is_desktop_surface(wsurface)) {
+ struct weston_desktop_surface *dsurface =
+ weston_surface_get_desktop_surface(wsurface);
+ return weston_desktop_surface_get_user_data(dsurface);
+ }
+
+ return NULL;
+}
+
void
agl_shell_desktop_advertise_application_id(struct ivi_compositor *ivi,
struct ivi_surface *surface)
@@ -744,6 +756,65 @@ ivi_shell_init(struct ivi_compositor *ivi)
return 0;
}
+
+static void
+ivi_surf_destroy(struct ivi_surface *surf)
+{
+ struct weston_surface *wsurface = surf->view->surface;
+
+ if (weston_surface_is_mapped(wsurface)) {
+ weston_desktop_surface_unlink_view(surf->view);
+ weston_view_destroy(surf->view);
+ }
+
+ wl_list_remove(&surf->link);
+ free(surf);
+}
+
+static void
+ivi_shell_destroy_views_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 ivi_surface *ivi_surf =
+ get_ivi_shell_surface(view->surface);
+ if (ivi_surf)
+ ivi_surf_destroy(ivi_surf);
+ }
+}
+
+static void
+ivi_shell_destroy_views_on_fullscreen_layer(struct ivi_compositor *ivi)
+{
+ struct ivi_output *ivi_output;
+
+ wl_list_for_each(ivi_output, &ivi->outputs, link)
+ weston_surface_destroy(ivi_output->fullscreen_view.fs->view->surface);
+}
+
+void
+ivi_shell_finalize(struct ivi_compositor *ivi)
+{
+ ivi_shell_destroy_views_on_layer(&ivi->hidden);
+ weston_layer_fini(&ivi->hidden);
+
+ ivi_shell_destroy_views_on_layer(&ivi->background);
+ weston_layer_fini(&ivi->background);
+
+ ivi_shell_destroy_views_on_layer(&ivi->normal);
+ weston_layer_fini(&ivi->normal);
+
+ ivi_shell_destroy_views_on_layer(&ivi->panel);
+ weston_layer_fini(&ivi->panel);
+
+ ivi_shell_destroy_views_on_layer(&ivi->popup);
+ weston_layer_fini(&ivi->popup);
+
+ ivi_shell_destroy_views_on_fullscreen_layer(ivi);
+ weston_layer_fini(&ivi->fullscreen);
+}
+
static void
ivi_shell_advertise_xdg_surfaces(struct ivi_compositor *ivi, struct wl_resource *resource)
{