genlist : fix content cache issue by content_get

Summary:
genlist content_get sometimes work weird after reusable_content_get pushed.
cached content is shown even content_get function is not exist or
return NULL.
now cache check item_class instead of item style string.

Test Plan: check genlist cache in elementary_test

Reviewers: Hermet, cedric, raster

Subscribers: Jaehyun_Cho, jpeg

Differential Revision: https://phab.enlightenment.org/D3921

Conflicts:
	src/lib/elementary/elm_genlist.c
This commit is contained in:
SangHyeon Lee 2016-05-11 20:32:55 +09:00
parent 42e459b364
commit 782f28e9a1
2 changed files with 6 additions and 6 deletions

View File

@ -1508,7 +1508,7 @@ _item_cache_free(Item_Cache *itc)
evas_object_del(itc->spacer);
evas_object_del(itc->base_view);
eina_stringshare_del(itc->item_style);
itc->item_class = NULL;
EINA_LIST_FREE(itc->contents, c)
{
evas_object_del(c);
@ -1568,7 +1568,7 @@ _item_cache_add(Elm_Gen_Item *it, Eina_List *contents)
}
itc->spacer = it->spacer;
itc->base_view = VIEW(it);
itc->item_style = eina_stringshare_add(it->itc->item_style);
itc->item_class = it->itc;
itc->contents = contents;
if (it->item->type & ELM_GENLIST_ITEM_TREE)
{
@ -1632,9 +1632,9 @@ _item_cache_find(Elm_Gen_Item *it)
EINA_INLIST_FOREACH_SAFE(sd->item_cache, l, itc)
{
if ((itc->tree == tree) &&
(((!it->itc->item_style) && (!itc->item_style)) ||
(it->itc->item_style && itc->item_style &&
(!strcmp(it->itc->item_style, itc->item_style)))))
(((!it->itc) && (!itc->item_class)) ||
(it->itc && itc->item_class &&
(it->itc == itc->item_class))))
{
itc = _item_cache_pop(sd, itc);
if (!itc) continue;

View File

@ -276,7 +276,7 @@ struct _Item_Cache
EINA_INLIST;
Evas_Object *base_view, *spacer;
const char *item_style; // it->itc->item_style
const Elm_Genlist_Item_Class *item_class; // it->itc
Eina_Bool tree : 1; // it->group
Eina_List *contents; // content objects for reusing
};