aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCedric BAIL <cedric.bail@free.fr>2018-05-28 19:31:23 +0200
committerBoris Faure <billiob@gmail.com>2018-06-28 19:25:18 +0200
commita5f287e881e0fa54f22dd39ccafd49ed05161643 (patch)
tree7c7fef20c6448170327aba848bfec23c88682f27
parentTerminology release 1.2.1 (diff)
downloadterminology-a5f287e881e0fa54f22dd39ccafd49ed05161643.tar.gz
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
-rw-r--r--src/bin/termio.c16
1 files changed, 16 insertions, 0 deletions
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,