From: ChunEon Park Date: Wed, 14 Jan 2015 14:30:43 +0000 (+0900) Subject: genlist: fix a crash when deleting a item in selected callback. X-Git-Tag: v1.13.0-beta1~17 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c80b24baf815e35c160bf0dbe8ecae6ea247aef8;p=platform%2Fupstream%2Felementary.git 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. --- 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); }