summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarius Vlad <marius.vlad@collabora.com>2020-05-30 22:12:13 +0300
committerJan-Simon Moeller <jsmoeller@linuxfoundation.org>2020-06-08 13:58:44 +0000
commita2f9566bdbfcb8ee05a1f0bf5b908a93bcc85f33 (patch)
treeb1814c868086e4fcbce07d692c49a7f90f090fa0
parent79420056715721321ec359a6aafdc3c3910bc4d6 (diff)
desktop: Handle correctly panel and bg removal of agl-shell unbind
We don't need to free the ivi_surface when un-binding the agl-shell, as that should happen when `desktop_surface_removed()` is called. We'll just invalidate them depending on the role so that next time we're going to able to bind again. Bug-AGL: SPEC-3404 Signed-off-by: Marius Vlad <marius.vlad@collabora.com> Change-Id: I6e06b6a1029989bf3e09156b602b6eab6addc5da
-rw-r--r--src/desktop.c23
-rw-r--r--src/shell.c15
2 files changed, 23 insertions, 15 deletions
diff --git a/src/desktop.c b/src/desktop.c
index 03a2186..8515a32 100644
--- a/src/desktop.c
+++ b/src/desktop.c
@@ -136,6 +136,29 @@ desktop_surface_removed(struct weston_desktop_surface *dsurface, void *userdata)
weston_view_destroy(surface->view);
}
+ /* invalidate agl-shell surfaces so we can re-use them when
+ * binding again */
+ if (surface->role == IVI_SURFACE_ROLE_PANEL) {
+ switch (surface->panel.edge) {
+ case AGL_SHELL_EDGE_TOP:
+ output->top = NULL;
+ break;
+ case AGL_SHELL_EDGE_BOTTOM:
+ output->bottom = NULL;
+ break;
+ case AGL_SHELL_EDGE_LEFT:
+ output->left = NULL;
+ break;
+ case AGL_SHELL_EDGE_RIGHT:
+ output->right = NULL;
+ break;
+ default:
+ assert(!"Invalid edge detected\n");
+ }
+ } else if (surface->role == IVI_SURFACE_ROLE_BACKGROUND) {
+ output->background = NULL;
+ }
+
wl_list_remove(&surface->link);
free(surface);
}
diff --git a/src/shell.c b/src/shell.c
index 96f3c0a..527cdba 100644
--- a/src/shell.c
+++ b/src/shell.c
@@ -617,21 +617,6 @@ unbind_agl_shell(struct wl_resource *resource)
ivi = wl_resource_get_user_data(resource);
wl_list_for_each(output, &ivi->outputs, link) {
- free(output->background);
- output->background = NULL;
-
- free(output->top);
- output->top = NULL;
-
- free(output->bottom);
- output->bottom = NULL;
-
- free(output->left);
- output->left = NULL;
-
- free(output->right);
- output->right = NULL;
-
/* reset the active surf if there's one present */
if (output->active) {
output->active->view->is_mapped = false;