genlist: Fixed a crash bug in case of calling a genlist_clear in a select callback function.

Summary:
If item select callback is elm_genlist_clear and genlist object have many item, elm_genlist_clear was broken.
This reason is due to incorrect code. In Old code, check the item focus  after an item was deleted. So, I changed the order of the code.
Before item was deleted, Check the item focus.
@fix

Test Plan: I revised the elementary_test code and tested with that.

Reviewers: raster, SanghyeonLee, seoz

Reviewed By: seoz

Subscribers: bluezery, SanghyeonLee

Differential Revision: https://phab.enlightenment.org/D1418
This commit is contained in:
Jae Yong Hwang 2014-09-06 01:47:55 +09:00 committed by Daniel Juyung Seo
parent 2533b0af79
commit fbee0944db
1 changed files with 15 additions and 14 deletions

View File

@ -5545,6 +5545,21 @@ _item_select(Elm_Gen_Item *it)
_elm_genlist_item_content_focus_set(it, ELM_FOCUS_PREVIOUS);
}
if (!(sd->focus_on_selection_enabled || _elm_config->item_select_on_focus_disable))
{
Evas_Object *swallow_obj;
Eina_List *l;
EINA_LIST_FOREACH(it->content_objs, l, swallow_obj)
{
if (elm_widget_is(swallow_obj) && elm_object_focus_get(swallow_obj))
{
elm_object_focus_set(obj, EINA_FALSE);
elm_object_focus_set(obj, EINA_TRUE);
break;
}
}
}
it->walking--;
sd->walking--;
if ((sd->clear_me) && (!sd->walking))
@ -5560,20 +5575,6 @@ _item_select(Elm_Gen_Item *it)
sd->last_selected_item = (Elm_Object_Item *)it;
}
if (!(sd->focus_on_selection_enabled || _elm_config->item_select_on_focus_disable))
{
Evas_Object *swallow_obj;
Eina_List *l;
EINA_LIST_FOREACH(it->content_objs, l, swallow_obj)
{
if (elm_widget_is(swallow_obj) && elm_object_focus_get(swallow_obj))
{
elm_object_focus_set(obj, EINA_FALSE);
elm_object_focus_set(obj, EINA_TRUE);
break;
}
}
}
evas_object_unref(obj);
}