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 <mateuszx.potrola@intel.com>
Reviewed-by: Emre Ucan <eucan@de.adit-jv.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
dev
Mateusz Polrola 9 years ago committed by Pekka Paalanen
parent c6a55dbf04
commit dada6e3b79
  1. 3
      ivi-shell/ivi-layout-private.h
  2. 16
      ivi-shell/ivi-layout-transition.c
  3. 2
      ivi-shell/ivi-layout.c

@ -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
*/

@ -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)
{

@ -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);

Loading…
Cancel
Save