jackdanielz pushed a commit to branch master.

http://git.enlightenment.org/core/elementary.git/commit/?id=da652191a7c90262af014f39a77ea0a025ad67ef

commit da652191a7c90262af014f39a77ea0a025ad67ef
Author: Daniel Zaoui <daniel.za...@samsung.com>
Date:   Sun May 17 14:59:06 2015 +0300

    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
---
 src/lib/elm_slideshow.c | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)

diff --git a/src/lib/elm_slideshow.c b/src/lib/elm_slideshow.c
index aae7150..08fd699 100644
--- a/src/lib/elm_slideshow.c
+++ b/src/lib/elm_slideshow.c
@@ -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*

-- 


Reply via email to