From cf0ff2ba917cf5d8ec29755e88d8616c646ee733 Mon Sep 17 00:00:00 2001 From: Vorobiov Vitalii Date: Wed, 21 May 2014 06:13:50 +0200 Subject: [PATCH] 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 --- src/lib/edje/edje_edit.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/lib/edje/edje_edit.c b/src/lib/edje/edje_edit.c index 7e9330617e..2ccd44c127 100644 --- a/src/lib/edje/edje_edit.c +++ b/src/lib/edje/edje_edit.c @@ -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 */