src/desktop: Add a compositor destroy listener 30/26930/3
authorMarius Vlad <marius.vlad@collabora.com>
Tue, 23 Nov 2021 18:46:37 +0000 (20:46 +0200)
committerJan-Simon Moeller <jsmoeller@linuxfoundation.org>
Fri, 10 Dec 2021 14:43:51 +0000 (14:43 +0000)
Tearing down the ivi compositor instance (the shell) requires listening
for such an event and handle any potential destruction of surfaces.
With it we use to destroying any pending surfaces might have been left.

Bug-AGL: SPEC-4133

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Change-Id: I911c590409700374007673da680b7a76f69be1b2

src/desktop.c
src/ivi-compositor.h
src/shell.c

index ac68b78..a0cb2d2 100644 (file)
@@ -436,6 +436,15 @@ static const struct weston_desktop_api desktop_api = {
        .set_xwayland_position = desktop_set_xwayland_position,
 };
 
+static void
+ivi_shell_destroy(struct wl_listener *listener, void *data)
+{
+       struct ivi_compositor *ivi = container_of(listener,
+                               struct ivi_compositor, destroy_listener);
+
+       ivi_compositor_destroy_pending_surfaces(ivi);
+}
+
 int
 ivi_desktop_init(struct ivi_compositor *ivi)
 {
@@ -445,5 +454,10 @@ ivi_desktop_init(struct ivi_compositor *ivi)
                return -1;
        }
 
+       if (!weston_compositor_add_destroy_listener_once(ivi->compositor,
+                       &ivi->destroy_listener, ivi_shell_destroy)) {
+               return -1;
+       }
+
        return 0;
 }
index 0449eb1..e89d215 100644 (file)
@@ -98,6 +98,8 @@ struct ivi_compositor {
        struct wl_list split_pending_apps;
        struct wl_list remote_pending_apps;
 
+       struct wl_listener destroy_listener;
+
        struct weston_layer hidden;
        struct weston_layer background;
        struct weston_layer normal;
@@ -424,4 +426,7 @@ ivi_destroy_waltham_destroy(struct ivi_surface *surface);
 bool
 ivi_check_pending_surface(struct ivi_surface *surface);
 
+void
+ivi_compositor_destroy_pending_surfaces(struct ivi_compositor *ivi);
+
 #endif
index 3f528de..6fcdfe8 100644 (file)
@@ -1068,7 +1068,7 @@ shell_desktop_set_app_property(struct wl_client *client,
        }
 }
 
-static void
+void
 ivi_compositor_destroy_pending_surfaces(struct ivi_compositor *ivi)
 {
        struct pending_popup *p_popup, *next_p_popup;