summaryrefslogtreecommitdiff
path: root/desktop-shell
diff options
context:
space:
mode:
authorDerek Foreman <derekf@osg.samsung.com>2015-04-14 17:09:06 -0500
committerPekka Paalanen <pekka.paalanen@collabora.co.uk>2015-05-26 13:07:58 +0300
commit039e9be49d25615d43d1197c54fc08e3f17794b3 (patch)
tree87b2cb90c52f9bbd1ba08c40cbf84c52aa21659c /desktop-shell
parent3dd570e754102b940a0177d5bdb18e9accada639 (diff)
downloadweston-039e9be49d25615d43d1197c54fc08e3f17794b3.tar.gz
weston-039e9be49d25615d43d1197c54fc08e3f17794b3.tar.bz2
weston-039e9be49d25615d43d1197c54fc08e3f17794b3.zip
desktop-shell: destroy surfaces in an idle handler after fade out
It's possible for more than one animation to be taking place on a view at the same time. If one of those animations is the shell's fade out for dying surfaces, its completion handler will trigger the surface destroy signal, causing other animations on the animation list to remove themselves. Since this removal occurs during the linked list walk, the compositor may crash. We move the actual surface destruction into an idle handler to avoid this. Signed-off-by: Derek Foreman <derekf@osg.samsung.com> Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk> Tested-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Diffstat (limited to 'desktop-shell')
-rw-r--r--desktop-shell/shell.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c
index 452cd5fd..8c37963a 100644
--- a/desktop-shell/shell.c
+++ b/desktop-shell/shell.c
@@ -177,6 +177,8 @@ struct shell_surface {
bool has_set_geometry, has_next_geometry;
int focus_count;
+
+ bool destroying;
};
struct shell_grab {
@@ -3575,7 +3577,7 @@ shell_handle_surface_destroy(struct wl_listener *listener, void *data)
}
static void
-fade_out_done(struct weston_view_animation *animation, void *data)
+fade_out_done_idle_cb(void *data)
{
struct shell_surface *shsurf = data;
@@ -3583,6 +3585,21 @@ fade_out_done(struct weston_view_animation *animation, void *data)
}
static void
+fade_out_done(struct weston_view_animation *animation, void *data)
+{
+ struct shell_surface *shsurf = data;
+ struct wl_event_loop *loop;
+
+ loop = wl_display_get_event_loop(
+ shsurf->surface->compositor->wl_display);
+
+ if (!shsurf->destroying) {
+ wl_event_loop_add_idle(loop, fade_out_done_idle_cb, shsurf);
+ shsurf->destroying = true;
+ }
+}
+
+static void
handle_resource_destroy(struct wl_listener *listener, void *data)
{
struct shell_surface *shsurf =