elementary: use Eo ref counting to prevent death of genlist items.

Differential Revision: https://phab.enlightenment.org/D6068
This commit is contained in:
Cedric BAIL 2018-04-16 16:40:39 -07:00
parent 2a51465593
commit 4b30a7df8e
1 changed files with 3 additions and 12 deletions

View File

@ -3706,9 +3706,7 @@ _elm_genlist_item_del_serious(Elm_Gen_Item *it)
sd->item_count--;
_elm_genlist_item_del_not_serious(it);
//(it->walking == -1) means it's already removed from the list.
if (it->walking != -1)
sd->items = eina_inlist_remove(sd->items, EINA_INLIST_GET(it));
sd->items = eina_inlist_remove(sd->items, EINA_INLIST_GET(it));
if (it->tooltip.del_cb)
it->tooltip.del_cb((void *)it->tooltip.data, WIDGET(it), it);
ELM_SAFE_FREE(it->long_timer, ecore_timer_del);
@ -5931,7 +5929,7 @@ _item_select(Elm_Gen_Item *it)
evas_object_ref(obj);
it->walking++;
efl_ref(eo_it);
elm_object_item_focus_set(eo_it, EINA_TRUE);
if ((it->base)->on_deletion) goto item_deleted;
_elm_genlist_item_content_focus_set(it, ELM_FOCUS_PREVIOUS);
@ -5946,7 +5944,7 @@ _item_select(Elm_Gen_Item *it)
efl_access_state_changed_signal_emit(eo_it, EFL_ACCESS_STATE_SELECTED, EINA_TRUE);
// delete item if it's requested deletion in the above callbacks.
if ((it->base)->on_deletion) goto item_deleted;
it->walking--;
efl_unref(eo_it);
if (!(sd->focus_on_selection_enabled || _elm_config->item_select_on_focus_disable))
{
@ -5957,7 +5955,6 @@ _item_select(Elm_Gen_Item *it)
return EINA_FALSE;
item_deleted:
it->walking = -1; //This item was removed from it's item list.
_item_del(it);
efl_del(eo_it);
evas_object_unref(obj);
@ -6041,12 +6038,6 @@ _elm_genlist_item_elm_widget_item_del_pre(Eo *eo_it EINA_UNUSED,
_item_select(). Just pend removing. Because this will be removed right
after in the _item_select(). So pratically, this item won't be
dangled. */
if (it->walking > 0)
{
ELM_GENLIST_DATA_GET_FROM_ITEM(it, sd);
sd->items = eina_inlist_remove(sd->items, EINA_INLIST_GET(it));
return EINA_FALSE;
}
if (_elm_config->atspi_mode)
efl_access_children_changed_del_signal_emit(WIDGET(it),eo_it);