jpeg pushed a commit to branch master.

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

commit fc40d3d5594fcce2b02876e0d9c63ca27644bf64
Author: Jean-Philippe Andre <[email protected]>
Date:   Fri Mar 10 11:17:16 2017 +0900

    genlist: Fix invalid state of reused content
    
    If an item is marked as disabled it should be re-enabled
    before being put in the reusable contents cache. Otherwise
    a following use of this object may result in a disabled
    item being used, making the UI effectively disfunctional.
    
    Also modify the test case to show and test this behaviour.
    
    Add an efl_isa() to protect calls to elm_widget APIs.
    
    Fixes T5236
    
    @fix
---
 src/bin/elementary/test_genlist.c | 20 ++++++++++----------
 src/lib/elementary/elm_genlist.c  |  4 ++--
 2 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/src/bin/elementary/test_genlist.c 
b/src/bin/elementary/test_genlist.c
index 83270c8..9565ece 100644
--- a/src/bin/elementary/test_genlist.c
+++ b/src/bin/elementary/test_genlist.c
@@ -5501,29 +5501,28 @@ static Evas_Object *
 gl_re2_content_get(void *data, Evas_Object *obj, const char *part)
 {
    int num = (int)(uintptr_t)data;
-   Evas_Object *lb = NULL;
+   Evas_Object *content = NULL;
    char buf[64];
 
    if (!strcmp(part, "elm.swallow.icon"))
      {
         printf("Creating NEW content (icon) for item # %d\n", num);
-        lb = elm_label_add(obj);
-        evas_object_color_set(lb, 255, 0, 0, 255); // NOTE: never do this in 
real app
+        content = elm_label_add(obj);
+        evas_object_color_set(content, 255, 0, 0, 255); // NOTE: never do this 
in real app
         snprintf(buf, sizeof(buf), "Content for item # %d", num);
-        elm_object_text_set(lb, buf);
-        return lb;
+        elm_object_text_set(content, buf);
      }
    if (!strcmp(part, "elm.swallow.end"))
      {
         printf("Creating NEW content (end) for item # %d\n", num);
-        lb = elm_label_add(obj);
-        evas_object_color_set(lb, 0, 255, 0, 255); // NOTE: never do this in 
real app
+        content = elm_button_add(obj);
+        evas_object_color_set(content, 0, 255, 0, 255); // NOTE: never do this 
in real app
         snprintf(buf, sizeof(buf), "Content for item # %d", num);
-        elm_object_text_set(lb, buf);
-        return lb;
+        elm_object_text_set(content, buf);
+        if ((num % 5) == 0) elm_object_disabled_set(content, EINA_TRUE);
      }
 
-   return NULL;
+   return content;
 }
 
 static Evas_Object *
@@ -5550,6 +5549,7 @@ gl_re2_reusable_content_get(void *data, Evas_Object *obj,
         printf("REUSING content (end) for item # %d\n", num);
         snprintf(buf, sizeof(buf), "Content for item # %d", num);
         elm_object_text_set(old, buf);
+        if ((num % 5) == 0) elm_object_disabled_set(old, EINA_TRUE);
         return old;
      }
 
diff --git a/src/lib/elementary/elm_genlist.c b/src/lib/elementary/elm_genlist.c
index 7b3e284..3197500 100644
--- a/src/lib/elementary/elm_genlist.c
+++ b/src/lib/elementary/elm_genlist.c
@@ -1655,8 +1655,8 @@ _content_cache_add(Elm_Gen_Item *it, Eina_List **cache)
    Evas_Object *content = NULL;
    EINA_LIST_FREE(it->contents, content)
      {
-        if (elm_widget_disabled_get(content))
-          elm_widget_disabled_set(content, EINA_TRUE);
+        if (efl_isa(content, ELM_WIDGET_CLASS) && 
elm_widget_disabled_get(content))
+          elm_widget_disabled_set(content, EINA_FALSE);
 
         *cache = eina_list_append(*cache, content);
      }

-- 


Reply via email to