From be1b5f8163cfaf6f3d4c52e821d5061ec0952641 Mon Sep 17 00:00:00 2001
|
From: Jeffy Chen <jeffy.chen@rock-chips.com>
|
Date: Mon, 30 May 2022 17:42:03 +0800
|
Subject: [PATCH 65/65] HACK: desktop-shell: Fix crash when closing APP in idle
|
|
This is a backport of upstream patches:
|
bd831407 libweston, desktop-shell: Add a wrapper for weston_surface reference
|
c41cdcab desktop-shell: Migrate surface_unlink_view
|
ab42159b desktop-shell: Add missing weston_view_destroy()
|
|
Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
|
---
|
desktop-shell/shell.c | 14 +++++++++-----
|
1 file changed, 9 insertions(+), 5 deletions(-)
|
|
diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c
|
index 8dcd416c1..bb5d02855 100644
|
--- a/desktop-shell/shell.c
|
+++ b/desktop-shell/shell.c
|
@@ -105,6 +105,7 @@ struct shell_surface {
|
|
struct weston_desktop_surface *desktop_surface;
|
struct weston_view *view;
|
+ struct weston_surface *wsurface_anim_fade;
|
int32_t last_width, last_height;
|
|
struct desktop_shell *shell;
|
@@ -265,10 +266,12 @@ desktop_shell_destroy_surface(struct shell_surface *shsurf)
|
wl_list_init(&shsurf_child->children_link);
|
}
|
wl_list_remove(&shsurf->children_link);
|
+ weston_desktop_surface_unlink_view(shsurf->view);
|
+ weston_view_destroy(shsurf->view);
|
|
wl_signal_emit(&shsurf->destroy_signal, shsurf);
|
+ weston_surface_destroy(shsurf->wsurface_anim_fade);
|
|
- weston_view_destroy(shsurf->view);
|
if (shsurf->output_destroy_listener.notify) {
|
wl_list_remove(&shsurf->output_destroy_listener.link);
|
shsurf->output_destroy_listener.notify = NULL;
|
@@ -2374,7 +2377,6 @@ desktop_surface_removed(struct weston_desktop_surface *desktop_surface,
|
weston_desktop_surface_set_user_data(shsurf->desktop_surface, NULL);
|
shsurf->desktop_surface = NULL;
|
|
- weston_desktop_surface_unlink_view(shsurf->view);
|
if (weston_surface_is_mapped(surface) &&
|
shsurf->shell->win_close_animation_type == ANIMATION_FADE) {
|
|
@@ -2386,8 +2388,6 @@ desktop_surface_removed(struct weston_desktop_surface *desktop_surface,
|
weston_fade_run(shsurf->view, 1.0, 0.0, 300.0,
|
fade_out_done, shsurf);
|
return;
|
- } else {
|
- weston_surface_destroy(surface);
|
}
|
}
|
|
@@ -2510,8 +2510,12 @@ desktop_surface_committed(struct weston_desktop_surface *desktop_surface,
|
if (!weston_surface_is_mapped(surface)) {
|
map(shell, shsurf, sx, sy);
|
surface->is_mapped = true;
|
- if (shsurf->shell->win_close_animation_type == ANIMATION_FADE)
|
+ /* as we need to survive the weston_surface destruction we'll
|
+ * need to take another reference */
|
+ if (shsurf->shell->win_close_animation_type == ANIMATION_FADE) {
|
+ shsurf->wsurface_anim_fade = surface;
|
++surface->ref_count;
|
+ }
|
return;
|
}
|
|
--
|
2.20.1
|