ecore/audio: free vio on in/out object destruction

ensure we don't leak these since that means we also leak the user's free
data and callback

Reviewed-by: Marcel Hollerbach <mail@marcel-hollerbach.de>
Differential Revision: https://phab.enlightenment.org/D11527
This commit is contained in:
Mike Blumenkrantz 2020-03-17 12:03:03 -04:00 committed by Marcel Hollerbach
parent e8eb67a557
commit c697965a8c
2 changed files with 10 additions and 2 deletions

View File

@ -187,9 +187,15 @@ _ecore_audio_in_efl_object_constructor(Eo *eo_obj, Ecore_Audio_Input *obj)
EOLIAN static void EOLIAN static void
_ecore_audio_in_efl_object_destructor(Eo *eo_obj, Ecore_Audio_Input *obj) _ecore_audio_in_efl_object_destructor(Eo *eo_obj, Ecore_Audio_Input *obj)
{ {
Ecore_Audio_Object *ea_obj = efl_data_scope_get(eo_obj, ECORE_AUDIO_CLASS);
if(obj->output) if(obj->output)
ecore_audio_obj_out_input_detach(obj->output, eo_obj); {
if (!ecore_audio_obj_out_input_detach(obj->output, eo_obj))
ERR("Failed to detach output %p!", obj->output);
}
if (ea_obj->vio)
_free_vio(ea_obj);
efl_destructor(efl_super(eo_obj, MY_CLASS)); efl_destructor(efl_super(eo_obj, MY_CLASS));
} }

View File

@ -147,11 +147,13 @@ _ecore_audio_out_efl_object_destructor(Eo *eo_obj, Ecore_Audio_Output *obj)
{ {
Eina_List *cur, *tmp; Eina_List *cur, *tmp;
Eo *in; Eo *in;
Ecore_Audio_Object *ea_obj = efl_data_scope_get(eo_obj, ECORE_AUDIO_CLASS);
EINA_LIST_FOREACH_SAFE(obj->inputs, cur, tmp, in) { EINA_LIST_FOREACH_SAFE(obj->inputs, cur, tmp, in) {
ecore_audio_obj_out_input_detach(eo_obj, in); ecore_audio_obj_out_input_detach(eo_obj, in);
} }
if (ea_obj->vio)
_free_vio(ea_obj);
efl_destructor(efl_super(eo_obj, MY_CLASS)); efl_destructor(efl_super(eo_obj, MY_CLASS));
} }