From 6d4038380b39f2047ec269017654208f1c01fbd3 Mon Sep 17 00:00:00 2001 From: Marius Vlad Date: Tue, 23 Nov 2021 20:46:37 +0200 Subject: src/desktop: Add a compositor destroy listener 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 Change-Id: I911c590409700374007673da680b7a76f69be1b2 --- src/desktop.c | 14 ++++++++++++++ src/ivi-compositor.h | 5 +++++ src/shell.c | 2 +- 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/src/desktop.c b/src/desktop.c index ac68b78..a0cb2d2 100644 --- a/src/desktop.c +++ b/src/desktop.c @@ -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; } diff --git a/src/ivi-compositor.h b/src/ivi-compositor.h index 0449eb1..e89d215 100644 --- a/src/ivi-compositor.h +++ b/src/ivi-compositor.h @@ -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 diff --git a/src/shell.c b/src/shell.c index 3f528de..6fcdfe8 100644 --- a/src/shell.c +++ b/src/shell.c @@ -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; -- cgit 1.2.3-korg