genlist : fix content cache issue by content_get
authorSangHyeon Lee <sh10233.lee@samsung.com>
Wed, 11 May 2016 11:32:55 +0000 (20:32 +0900)
committerSangHyeon Lee <sh10233.lee@samsung.com>
Wed, 11 May 2016 22:12:18 +0000 (07:12 +0900)
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

src/lib/elementary/elm_genlist.c
src/lib/elementary/elm_widget_genlist.h

index 1abfe0c..45bb5b3 100644 (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;
index bf06755..393f2a9 100644 (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
 };