forked from enlightenment/efl
elm_gesture_layer: Arrange the logic for delete the target object in gesture cb.
When the user receives the callback of gesture callback, erases the target object, the gesture layer is deleted. The memory is may broken and performing unnecessary operations during the logic. Reviewed-by: Marcel Hollerbach <mail@marcel-hollerbach.de> Differential Revision: https://phab.enlightenment.org/D11838
This commit is contained in:
parent
5797129334
commit
5ca1a8c8a7
|
@ -1145,11 +1145,12 @@ _pending_device_add(Eina_List *list,
|
||||||
* user may cancel refeed of events by setting repeat events.
|
* user may cancel refeed of events by setting repeat events.
|
||||||
*
|
*
|
||||||
* @param obj The gesture-layer object.
|
* @param obj The gesture-layer object.
|
||||||
|
* @param need_reset Clear all gestures data or not.
|
||||||
*
|
*
|
||||||
* @ingroup Elm_Gesture_Layer
|
* @ingroup Elm_Gesture_Layer
|
||||||
*/
|
*/
|
||||||
static Eina_Bool
|
static Eina_Bool
|
||||||
_event_history_clear(Evas_Object *obj)
|
_event_history_clear(Evas_Object *obj, Eina_Bool need_reset)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
Gesture_Info *p;
|
Gesture_Info *p;
|
||||||
|
@ -1179,6 +1180,7 @@ _event_history_clear(Evas_Object *obj)
|
||||||
_states_reset(sd); /* we are ready to start testing for gestures again */
|
_states_reset(sd); /* we are ready to start testing for gestures again */
|
||||||
|
|
||||||
/* Clear all gestures intermediate data */
|
/* Clear all gestures intermediate data */
|
||||||
|
if (need_reset)
|
||||||
{
|
{
|
||||||
/* FIXME: +1 because of the mistake in the enum. */
|
/* FIXME: +1 because of the mistake in the enum. */
|
||||||
Gesture_Info **gitr = sd->gesture + 1;
|
Gesture_Info **gitr = sd->gesture + 1;
|
||||||
|
@ -1263,7 +1265,7 @@ _clear_if_finished(Evas_Object *obj)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (reset_s && (!all_undefined))
|
if (reset_s && (!all_undefined))
|
||||||
return _event_history_clear(obj);
|
return _event_history_clear(obj, EINA_TRUE);
|
||||||
|
|
||||||
return EINA_FALSE;
|
return EINA_FALSE;
|
||||||
}
|
}
|
||||||
|
@ -1348,6 +1350,7 @@ _event_process(void *data,
|
||||||
|
|
||||||
ELM_GESTURE_LAYER_DATA_GET(data, sd);
|
ELM_GESTURE_LAYER_DATA_GET(data, sd);
|
||||||
|
|
||||||
|
evas_object_ref(sd->target);
|
||||||
/* Start testing candidate gesture from here */
|
/* Start testing candidate gesture from here */
|
||||||
if (_pointer_event_make(data, event_info, event_type, &_pe))
|
if (_pointer_event_make(data, event_info, event_type, &_pe))
|
||||||
pe = &_pe;
|
pe = &_pe;
|
||||||
|
@ -1386,6 +1389,8 @@ _event_process(void *data,
|
||||||
Eina_Bool states_reset = _clear_if_finished(data);
|
Eina_Bool states_reset = _clear_if_finished(data);
|
||||||
if (sd->glayer_continues_enable)
|
if (sd->glayer_continues_enable)
|
||||||
_continues_gestures_restart(data, states_reset);
|
_continues_gestures_restart(data, states_reset);
|
||||||
|
|
||||||
|
evas_object_unref(sd->target);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Eina_Bool
|
static Eina_Bool
|
||||||
|
@ -3812,7 +3817,7 @@ _elm_gesture_layer_efl_canvas_group_group_del(Eo *obj, Elm_Gesture_Layer_Data *s
|
||||||
ecore_timer_del(sd->gest_taps_timeout);
|
ecore_timer_del(sd->gest_taps_timeout);
|
||||||
|
|
||||||
/* Then take care of clearing events */
|
/* Then take care of clearing events */
|
||||||
_event_history_clear(obj);
|
_event_history_clear(obj, EINA_FALSE);
|
||||||
sd->pending = eina_list_free(sd->pending);
|
sd->pending = eina_list_free(sd->pending);
|
||||||
|
|
||||||
EINA_LIST_FREE(sd->touched, data)
|
EINA_LIST_FREE(sd->touched, data)
|
||||||
|
|
Loading…
Reference in New Issue