billiob pushed a commit to branch terminology-1.2. http://git.enlightenment.org/apps/terminology.git/commit/?id=a5f287e881e0fa54f22dd39ccafd49ed05161643
commit a5f287e881e0fa54f22dd39ccafd49ed05161643 Author: Cedric BAIL <[email protected]> Date: Mon May 28 19:31:23 2018 +0200 termio: make sure that reference to gesture layer are cleaned at the right time. Reviewers: billiob Reviewed By: billiob Subscribers: cedric Tags: #terminology Differential Revision: https://phab.enlightenment.org/D6207 --- src/bin/termio.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/bin/termio.c b/src/bin/termio.c index 7c87a94..1ffb350 100644 --- a/src/bin/termio.c +++ b/src/bin/termio.c @@ -6034,6 +6034,21 @@ _smart_cb_drop(void *data, return EINA_TRUE; } +// As we do not control the lifecycle of the Evas_Object *win, +// the death of the gesture layer can happen before the termio +// is destroyed. So by NULLing the structure field on gesture +// death, we make sure to not manipulate dead pointer +static void +_gesture_layer_death(void *data, + Evas *e EINA_UNUSED, + Evas_Object *obj EINA_UNUSED, + void *event EINA_UNUSED) +{ + Termio *sd = data; + + sd->glayer = NULL; +} + /* }}} */ @@ -6074,6 +6089,7 @@ termio_add(Evas_Object *win, Config *config, sd->win = win; sd->glayer = g = elm_gesture_layer_add(win); + evas_object_event_callback_add(g, EVAS_CALLBACK_FREE, _gesture_layer_death); elm_gesture_layer_attach(g, sd->event); elm_gesture_layer_cb_set(g, ELM_GESTURE_N_LONG_TAPS, --
