SlideShow: Fix double invocation of ItemClass delete function

When closing the application, the delete function given by the user in
the Item Class was called twice. During the clear process, the function
was called for every built item and then during the item destruction.

This patch fixes this behaviour by calling the user function only during
the item destruction.

Another fix has been added. It zero'es the built list pointer inside the
item. Without this fix, the item points to a list node that is already
freed and can lead during widget deletion to an invalid access inside
the list.

@fix T2394
This commit is contained in:
Daniel Zaoui 2015-05-17 14:59:06 +03:00
parent ef01775db8
commit e4e5ccb34d
1 changed files with 4 additions and 9 deletions

View File

@ -238,6 +238,7 @@ _item_realize(Elm_Slideshow_Item_Data *item)
if (item->itc->func.del)
item->itc->func.del(elm_object_item_data_get(EO_OBJ(item)), VIEW(item));
ELM_SAFE_FREE(VIEW(item), evas_object_del);
item->l_built = NULL;
}
}
@ -628,19 +629,13 @@ _elm_slideshow_loop_get(Eo *obj EINA_UNUSED, Elm_Slideshow_Data *sd)
EOLIAN static void
_elm_slideshow_clear(Eo *obj EINA_UNUSED, Elm_Slideshow_Data *sd)
{
Elm_Slideshow_Item_Data *item;
Eo *eo_item;
Eina_List *itr, *itr2;
sd->previous = NULL;
sd->current = NULL;
EINA_LIST_FREE(sd->items_built, item)
{
if (item->itc->func.del)
item->itc->func.del(elm_object_item_data_get(EO_OBJ(item)), VIEW(item));
}
EINA_LIST_FREE(sd->items, eo_item)
eo_del(eo_item);
EINA_LIST_FOREACH_SAFE(sd->items, itr, itr2, eo_item)
eo_del(eo_item);
}
EOLIAN static const Eina_List*