summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSangHyeon Lee <sh10233.lee@samsung.com>2016-04-01 16:40:16 +0900
committerSangHyeon Lee <sh10233.lee@samsung.com>2016-04-01 16:40:16 +0900
commitfc2f341e412df4e60a98996f8639fe2b12333be2 (patch)
tree27efedc2d9df9cc614735c4a175b0be6f2ec5b73
parente8c3346379638f085613df61277ebd784faf235a (diff)
downloadefl-fc2f341e412df4e60a98996f8639fe2b12333be2.tar.gz
fix item_class refcount bug when class updated
-rw-r--r--src/lib/elementary/elm_genlist.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/lib/elementary/elm_genlist.c b/src/lib/elementary/elm_genlist.c
index 6a8e8a2215..d5f56499cd 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;