From dada6e3b79aa9219f431a212877ab5391ef72d13 Mon Sep 17 00:00:00 2001 From: Mateusz Polrola Date: Wed, 9 Mar 2016 09:13:26 +0000 Subject: ivi-shell: Remove all surface transitions when it is being removed. If surface transitions are not removed when surface is being removed, it can lead to crash later when transition will finish, as it will try to reference already freed memory. This change exposes function that can remove all existing transitions for given surface and it is being called during surface cleanup. Signed-off-by: Mateusz Polrola Reviewed-by: Emre Ucan Reviewed-by: Bryce Harrington Reviewed-by: Pekka Paalanen --- ivi-shell/ivi-layout-private.h | 3 +++ ivi-shell/ivi-layout-transition.c | 16 ++++++++++++++++ ivi-shell/ivi-layout.c | 2 ++ 3 files changed, 21 insertions(+) diff --git a/ivi-shell/ivi-layout-private.h b/ivi-shell/ivi-layout-private.h index 3a23ef47..8c847e7e 100644 --- a/ivi-shell/ivi-layout-private.h +++ b/ivi-shell/ivi-layout-private.h @@ -158,6 +158,9 @@ ivi_layout_transition_fade_layer(struct ivi_layout_layer *layer, int32_t is_surface_transition(struct ivi_layout_surface *surface); +void +ivi_layout_remove_all_surface_transitions(struct ivi_layout_surface *surface); + /** * methods of interaction between ivi-shell with ivi-layout */ diff --git a/ivi-shell/ivi-layout-transition.c b/ivi-shell/ivi-layout-transition.c index 3b613a5e..ed119993 100644 --- a/ivi-shell/ivi-layout-transition.c +++ b/ivi-shell/ivi-layout-transition.c @@ -99,6 +99,22 @@ is_surface_transition(struct ivi_layout_surface *surface) return 0; } +void +ivi_layout_remove_all_surface_transitions(struct ivi_layout_surface *surface) +{ + struct ivi_layout *layout = get_instance(); + struct transition_node *node; + struct transition_node *tmp; + struct ivi_layout_transition *tran; + + wl_list_for_each_safe(node, tmp, &layout->transitions->transition_list, link) { + tran = node->transition; + if (tran->is_transition_func(tran->private_data, surface)) { + layout_transition_destroy(tran); + } + }; +} + static void tick_transition(struct ivi_layout_transition *transition, uint32_t timestamp) { diff --git a/ivi-shell/ivi-layout.c b/ivi-shell/ivi-layout.c index c324b5eb..61897ef8 100644 --- a/ivi-shell/ivi-layout.c +++ b/ivi-shell/ivi-layout.c @@ -241,6 +241,8 @@ ivi_layout_surface_destroy(struct ivi_layout_surface *ivisurf) wl_signal_emit(&layout->surface_notification.removed, ivisurf); + ivi_layout_remove_all_surface_transitions(ivisurf); + remove_configured_listener(ivisurf); ivi_layout_surface_remove_notification(ivisurf); -- cgit v1.2.3