edje: Edje_Edit - fix wrong behaviour on draggable.event processing while deleting parts.

Summary:
the draggable.event field (in edje) is pointing on the id of the part it is assigned to.
The main problem is about deleting parts.
After part being deleted, all other parts (that are below the deleted part) have their id shifted,
but event doesnt shift.

For example,
1) draggable.event at some part pointing at part with id=7,
2) some other part is being deleted
3) part with id=7 have new id now (id=6)
4) draggable.event DOESN'T change it's pointer and still points at part with id=7 (which is now has id=6)
5) if there is no parts with id=7 anymore, then it could give you SEGFAULT someday (or not, depending on luck).

This commit contains next changes:
1) after deleting part, draggable.event also shifts (if required)
2) after deleting part that is being pointed with event by someone, it will remove all event points at it
@fix

Reviewers: cedric, raster, seoz

CC: reutskiy.v.v, cedric

Differential Revision: https://phab.enlightenment.org/D878

Signed-off-by: Cedric Bail <cedric.bail@free.fr>
This commit is contained in:
Vorobiov Vitalii 2014-05-21 06:13:50 +02:00 committed by Cedric Bail
parent 42e049fe86
commit cf0ff2ba91
1 changed files with 10 additions and 1 deletions

View File

@ -2398,7 +2398,16 @@ edje_edit_part_del(Evas_Object *obj, const char* part)
real->part->clip_to_id = -1;
}
if (real->drag && real->drag->confine_to == rp)
real->drag->confine_to = NULL;
{
real->drag->confine_to = NULL;
}
if (real->part->dragable.event_id != -1)
{
if (real->part->dragable.event_id == TO_INT(id))
real->part->dragable.event_id = -1;
else if (i > id)
real->part->dragable.event_id--;
}
}
/* Unlink all the parts and descriptions that refer to id */