evas: protect against leaking callbacks

Summary:
when someone accidently does not clean up all his animation callbacks,
we might end up with a lot of errors on console, as we keep delivering
tick events to a dead object.

Reviewers: zmike, cedric, segfaultxavi

Reviewed By: zmike

Subscribers: #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D10998
This commit is contained in:
Marcel Hollerbach 2020-01-02 09:35:31 -05:00 committed by Mike Blumenkrantz
parent 4fb7d88126
commit 9d428c610d
3 changed files with 9 additions and 1 deletions

View File

@ -872,3 +872,10 @@ evas_object_callbacks_event_catcher_del(Eo *eo_obj EINA_UNUSED, Evas_Object_Prot
}
}
void
evas_object_callbacks_shutdown(Eo *eo_obj EINA_UNUSED, Evas_Object_Protected_Data *obj)
{
if (obj->animator_ref > 0)
efl_event_callback_del(obj->layer->evas->evas, EFL_CANVAS_OBJECT_EVENT_ANIMATOR_TICK, _animator_repeater, obj);
obj->animator_ref = 0;
}

View File

@ -1179,7 +1179,7 @@ _efl_canvas_object_efl_object_destructor(Eo *eo_obj, Evas_Object_Protected_Data
end:
evas_object_event_callback_all_del(eo_obj);
evas_object_event_callback_cleanup(eo_obj);
evas_object_callbacks_shutdown(eo_obj, obj);
efl_destructor(efl_super(eo_obj, MY_CLASS));
}

View File

@ -1623,6 +1623,7 @@ void evas_event_callback_call(Evas *e, Evas_Callback_Type type, void *event_info
void evas_object_callbacks_finalized(Eo *eo_obj EINA_UNUSED, Evas_Object_Protected_Data *obj);
void evas_object_callbacks_event_catcher_add(Eo *eo_obj EINA_UNUSED, Evas_Object_Protected_Data *obj, const Efl_Callback_Array_Item *array);
void evas_object_callbacks_event_catcher_del(Eo *eo_obj EINA_UNUSED, Evas_Object_Protected_Data *obj, const Efl_Callback_Array_Item *array);
void evas_object_callbacks_shutdown(Eo *eo_obj EINA_UNUSED, Evas_Object_Protected_Data *obj);
void evas_object_event_callback_call(Evas_Object *obj, Evas_Object_Protected_Data *pd, Evas_Callback_Type type, void *event_info, int event_id, const Efl_Event_Description *efl_event_desc);
Eina_List *evas_event_objects_event_list(Evas *e, Evas_Object *stop, int x, int y);