From c80b24baf815e35c160bf0dbe8ecae6ea247aef8 Mon Sep 17 00:00:00 2001 From: ChunEon Park Date: Wed, 14 Jan 2015 23:30:43 +0900 Subject: [PATCH] genlist: fix a crash when deleting a item in selected callback. if user deletes the item in the callback, current function(_item_select) would be corrupted. just leave the callback call in the last of the function. --- src/lib/elm_genlist.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/lib/elm_genlist.c b/src/lib/elm_genlist.c index a4ebbf8..81d6246 100644 --- a/src/lib/elm_genlist.c +++ b/src/lib/elm_genlist.c @@ -5669,9 +5669,6 @@ _item_select(Elm_Gen_Item *it) eina_list_append(sd->selected, eo_it); } - evas_object_ref(obj); - if (it->func.func) it->func.func((void *)it->func.data, WIDGET(it), eo_it); - evas_object_smart_callback_call(WIDGET(it), SIG_SELECTED, eo_it); elm_object_item_focus_set(eo_it, EINA_TRUE); _elm_genlist_item_content_focus_set(it, ELM_FOCUS_PREVIOUS); @@ -5692,6 +5689,12 @@ _item_select(Elm_Gen_Item *it) } } + evas_object_ref(obj); + + if (it->func.func) it->func.func((void *)it->func.data, WIDGET(it), eo_it); + if (EINA_MAGIC_CHECK((Elm_Widget_Item_Data *)it, ELM_WIDGET_ITEM_MAGIC)) + evas_object_smart_callback_call(WIDGET(it), SIG_SELECTED, eo_it); + evas_object_unref(obj); } -- 2.7.4