summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorshashank.p <shashank.p@samsung.com>2015-11-11 15:30:58 +0900
committerSangHyeon Lee <sh10233.lee@samsung.com>2015-11-11 15:30:58 +0900
commitc14067852ceb1d9b5fa89b80b6376ee83bb3a3af (patch)
treefc9e83703e0333461f2b35cfeaf83f2eff74c882
parent178fad6d1c0435dfc724a7eea95423e362a7789d (diff)
downloadelementary-c14067852ceb1d9b5fa89b80b6376ee83bb3a3af.tar.gz
Genlist: Fixed a possible crash in filter iterator and a typo.
Summary: 1. If the sd->items list is empty any time and container_get is used on filter iterator, it will lead to crash. Solution is to not rely on sd->items and maintain a pointer to container when iterator is created. 2. There was a typo while filter feature was added earlier. Fixed it @fix Test Plan: NA Reviewers: SanghyeonLee Reviewed By: SanghyeonLee Subscribers: rajeshps, shilpasingh Differential Revision: https://phab.enlightenment.org/D3319
-rw-r--r--src/lib/elm_genlist.c7
-rw-r--r--src/lib/elm_widget_genlist.h1
2 files changed, 5 insertions, 3 deletions
diff --git a/src/lib/elm_genlist.c b/src/lib/elm_genlist.c
index 3c51e40d4..d2d0005f2 100644
--- a/src/lib/elm_genlist.c
+++ b/src/lib/elm_genlist.c
@@ -7522,7 +7522,7 @@ _item_filter_enterer(void *data)
}
if (ok == ECORE_CALLBACK_CANCEL)
{
- sd->queue_idle_enterer = NULL;
+ sd->queue_filter_enterer = NULL;
eo_do(sd->obj, eo_event_callback_call(ELM_GENLIST_EVENT_FILTER_DONE, NULL));
}
@@ -7605,8 +7605,8 @@ _filter_iterator_free(Elm_Genlist_Filter *iter)
static Evas_Object *
_filter_iterator_get_container(Elm_Genlist_Filter *iter)
{
- Elm_Gen_Item *it = ELM_GENLIST_FILTER_ITERATOR_ITEM_GET(iter->head, Elm_Gen_Item);
- return WIDGET(it);
+ if (!iter) return NULL;
+ return iter->obj;
}
EOLIAN Eina_Iterator *
@@ -7618,6 +7618,7 @@ _elm_genlist_filter_iterator_new(Eo *obj EINA_UNUSED, Elm_Genlist_Data *sd)
iter->head = sd->items;
iter->current = sd->items;
+ iter->obj = sd->obj;
iter->iterator.version = EINA_ITERATOR_VERSION;
iter->iterator.next = FUNC_ITERATOR_NEXT(_filter_iterator_next);
diff --git a/src/lib/elm_widget_genlist.h b/src/lib/elm_widget_genlist.h
index dbd392e49..48cd9d52e 100644
--- a/src/lib/elm_widget_genlist.h
+++ b/src/lib/elm_widget_genlist.h
@@ -297,6 +297,7 @@ struct _Elm_Genlist_Filter
Eina_Iterator iterator;
const Eina_Inlist *head;
const Eina_Inlist *current;
+ Evas_Object *obj;
};
#define ELM_GENLIST_FILTER_ITERATOR_ITEM_GET(ptr, \