elc_naviframe: Delete naviframe items in LIFO manner on widget deletion.

Summary:
Naviframe manages items in the form of a stack, but deletion is happening
in FIFO manner, the deletion of items on widget deletion should also happen
in LIFO manner.

Use Case: Application allocates memory on first push and passes down the same
handle for all subsequent pushes, now on deletion as first item is deleted first
crash happens when the memory is accessed in second item on its deletion.
hence Naviframe should also delete items in LIFO manner.

@feature

Test Plan:
elementary_test->naviframe->push multiple pages
Now terminate the app, the items should be deleted in LIFO
manner.

Reviewers: Hermet, Jaehyun, Jaehyun_Cho

Reviewed By: Jaehyun_Cho

Subscribers: cedric, govi, rajeshps, jpeg

Differential Revision: https://phab.enlightenment.org/D4483
This commit is contained in:
Shilpa Singh 2016-12-13 20:56:18 +09:00 committed by Jaehyun Cho
parent bcfc33fd00
commit 3d452bdc60
1 changed files with 5 additions and 2 deletions

View File

@ -1458,12 +1458,15 @@ _elm_naviframe_efl_canvas_group_group_del(Eo *obj, Elm_Naviframe_Data *sd)
{
Elm_Naviframe_Item_Data *it;
Elm_Naviframe_Op *nfo;
Eina_Inlist *l = NULL;
sd->on_deletion = EINA_TRUE;
if (sd->stack) l = sd->stack->last;
while (sd->stack)
while (l)
{
it = EINA_INLIST_CONTAINER_GET(sd->stack, Elm_Naviframe_Item_Data);
it = EINA_INLIST_CONTAINER_GET(l, Elm_Naviframe_Item_Data);
l = l->prev;
elm_wdg_item_del(EO_OBJ(it));
}