summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2017-03-10 11:17:16 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2017-03-10 11:22:13 +0900
commitfc40d3d5594fcce2b02876e0d9c63ca27644bf64 (patch)
tree9d7d858e4f789b878684163c095c482b3db04113
parent09f132b556c43c9c8f42e1b194a500c2b6317bc7 (diff)
downloadefl-fc40d3d5594fcce2b02876e0d9c63ca27644bf64.tar.gz
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
-rw-r--r--src/bin/elementary/test_genlist.c20
-rw-r--r--src/lib/elementary/elm_genlist.c4
2 files changed, 12 insertions, 12 deletions
diff --git a/src/bin/elementary/test_genlist.c b/src/bin/elementary/test_genlist.c
index 83270c83a7..9565ece864 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 7b3e284440..3197500492 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);
}