sanghyeonlee pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=fc2f341e412df4e60a98996f8639fe2b12333be2

commit fc2f341e412df4e60a98996f8639fe2b12333be2
Author: SangHyeon Lee <sh10233....@samsung.com>
Date:   Fri Apr 1 16:40:16 2016 +0900

    fix item_class refcount bug when class updated
---
 src/lib/elementary/elm_genlist.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/src/lib/elementary/elm_genlist.c b/src/lib/elementary/elm_genlist.c
index 6a8e8a2..d5f5649 100644
--- a/src/lib/elementary/elm_genlist.c
+++ b/src/lib/elementary/elm_genlist.c
@@ -7070,7 +7070,15 @@ _elm_genlist_item_item_class_update(Eo *eo_it, 
Elm_Gen_Item *it,
 {
    ELM_GENLIST_ITEM_CHECK_OR_RETURN(it);
    EINA_SAFETY_ON_NULL_RETURN(itc);
-   it->itc = itc;
+
+   /* Decrease the orignal item class refcount to prevent memory leak */
+   if (it->itc != itc)
+     {
+        elm_genlist_item_class_unref((Elm_Genlist_Item_Class *)it->itc);
+        it->itc = itc;
+        elm_genlist_item_class_ref((Elm_Genlist_Item_Class *)it->itc);
+     }
+
    if (!it->item->block) return;
    it->item->nocache_once = EINA_TRUE;
 

-- 


Reply via email to