sanghyeonlee pushed a commit to branch master. http://git.enlightenment.org/core/elementary.git/commit/?id=c14067852ceb1d9b5fa89b80b6376ee83bb3a3af
commit c14067852ceb1d9b5fa89b80b6376ee83bb3a3af Author: shashank.p <shashan...@samsung.com> Date: Wed Nov 11 15:30:58 2015 +0900 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 --- src/lib/elm_genlist.c | 7 ++++--- src/lib/elm_widget_genlist.h | 1 + 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/lib/elm_genlist.c b/src/lib/elm_genlist.c index 3c51e40..d2d0005 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 dbd392e..48cd9d5 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, \ --