list: initialize some internal variables on item free not item del pre.

This fixes variable initialize problems related to focus. This can be
reproduced when you enable focus highlight/animation and reuse
elm_list by clearing it.

This problem occurred because list item del pre is never been called.
This bug will be addressed in a next commit.
This commit is contained in:
Daniel Juyung Seo 2014-05-10 23:37:03 +09:00
parent 8ffbf246f4
commit 254798b47e
1 changed files with 12 additions and 9 deletions

View File

@ -73,6 +73,18 @@ static const Elm_Action key_actions[] = {
static inline void
_elm_list_item_free(Elm_List_Item *it)
{
ELM_LIST_DATA_GET(WIDGET(it), sd);
if (sd->focused_item == (Elm_Object_Item *)it)
sd->focused_item = NULL;
if (sd->last_focused_item == (Elm_Object_Item *)it)
sd->last_focused_item = NULL;
if (sd->prev_focused_item == (Elm_Object_Item *)it)
sd->prev_focused_item = NULL;
if (sd->last_selected_item == (Elm_Object_Item *)it)
sd->last_selected_item = NULL;
evas_object_event_callback_del_full
(VIEW(it), EVAS_CALLBACK_MOUSE_DOWN, _mouse_down_cb, it);
evas_object_event_callback_del_full
@ -1881,15 +1893,6 @@ _item_del_pre_hook(Elm_Object_Item *it)
sd->items = eina_list_remove_list(sd->items, item->node);
if (sd->focused_item == (Elm_Object_Item *)it)
sd->focused_item = NULL;
if (sd->last_focused_item == (Elm_Object_Item *)it)
sd->last_focused_item = NULL;
if (sd->prev_focused_item == (Elm_Object_Item *)it)
sd->prev_focused_item = NULL;
if (sd->last_selected_item == (Elm_Object_Item *)it)
sd->last_selected_item = NULL;
evas_object_ref(obj);
_elm_list_walk(sd);