Fix for dispatching drag event 90/163090/1
authorLukasz Wlazly <l.wlazly@partner.samsung.com>
Thu, 7 Dec 2017 07:02:11 +0000 (08:02 +0100)
committerLukasz Wlazly <l.wlazly@partner.samsung.com>
Thu, 7 Dec 2017 07:02:11 +0000 (08:02 +0100)
Add guard during execution of drag event.
This will prevent from crashing when another drag event is being started
during previous is being executed.

Change-Id: I65b92023c9811eb17a3099758b882dcf5b8d3e6e

src/e_dispatch_gesture_event.c

index 24cf957..e05ba3e 100644 (file)
@@ -45,6 +45,7 @@ typedef struct _TouchCommand {
 
 static TouchCommand tc;
 static DragTouchCommand dtc;
+Eina_Bool during_drag = EINA_FALSE;
 
 static int _move_count = -1;
 static int _zw = 0;
@@ -502,6 +503,7 @@ _drag_touch_sequence_timer(void *data)
 
    dtc->ts++;
    dtc->ts->dispatch_func(dtc->type, dtc->x2, dtc->y2, 0);
+   during_drag = EINA_FALSE;
 
    return ECORE_CALLBACK_CANCEL;
 }
@@ -566,6 +568,9 @@ void _e_dispatch_gesture_event(int type, int x, int y)
 
 void _e_dispatch_drag_event(int x1, int y1, int x2, int y2, int steps, double hold_time)
 {
+   if (during_drag)
+     return;
+
    E_Zone *zone;
 
    zone = e_zone_current_get();
@@ -604,5 +609,6 @@ void _e_dispatch_drag_event(int x1, int y1, int x2, int y2, int steps, double ho
    dtc.sequence_counter = 0;
    dtc.ts = _ts_drag;
 
+   during_drag = EINA_TRUE;
    ecore_timer_add(0.0, _drag_touch_sequence_timer, &dtc);
 }