fix item_class refcount bug when class updated

This commit is contained in:
SangHyeon Lee 2016-04-01 16:40:16 +09:00
parent e8c3346379
commit fc2f341e41
1 changed files with 9 additions and 1 deletions

View File

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