forked from enlightenment/efl
ecore-audio - protect against more list-walking while list is modified
This commit is contained in:
parent
294b05c874
commit
80d666e7a4
|
@ -214,27 +214,35 @@ static void _input_detach(Eo *eo_obj, void *_pd EINA_UNUSED, va_list *list)
|
||||||
|
|
||||||
static void _state_cb(pa_context *context, void *data EINA_UNUSED)
|
static void _state_cb(pa_context *context, void *data EINA_UNUSED)
|
||||||
{
|
{
|
||||||
Eina_List *out;
|
Eina_List *out, *tmp;
|
||||||
Eo *eo_obj;
|
Eo *eo_obj;
|
||||||
pa_context_state_t state;
|
pa_context_state_t state;
|
||||||
|
|
||||||
state = pa_context_get_state(context);
|
state = pa_context_get_state(context);
|
||||||
class_vars.state = state;
|
class_vars.state = state;
|
||||||
|
|
||||||
if (state == PA_CONTEXT_READY) {
|
//ref everything in the list to be sure...
|
||||||
DBG("PA context ready.");
|
EINA_LIST_FOREACH(class_vars.outputs, out, eo_obj) {
|
||||||
EINA_LIST_FOREACH(class_vars.outputs, out, eo_obj) {
|
eo_ref(eo_obj);
|
||||||
eo_do(eo_obj, eo_event_callback_call(ECORE_AUDIO_EV_OUT_PULSE_CONTEXT_READY, NULL, NULL));
|
}
|
||||||
}
|
// the callback here can delete things in the list..
|
||||||
} else if ((state == PA_CONTEXT_FAILED) || (state == PA_CONTEXT_TERMINATED)) {
|
if (state == PA_CONTEXT_READY) {
|
||||||
DBG("PA context fail.");
|
DBG("PA context ready.");
|
||||||
EINA_LIST_FOREACH(class_vars.outputs, out, eo_obj) {
|
EINA_LIST_FOREACH(class_vars.outputs, out, eo_obj) {
|
||||||
eo_do(eo_obj, eo_event_callback_call(ECORE_AUDIO_EV_OUT_PULSE_CONTEXT_FAIL, NULL, NULL));
|
eo_do(eo_obj, eo_event_callback_call(ECORE_AUDIO_EV_OUT_PULSE_CONTEXT_READY, NULL, NULL));
|
||||||
}
|
}
|
||||||
} else {
|
} else if ((state == PA_CONTEXT_FAILED) || (state == PA_CONTEXT_TERMINATED)) {
|
||||||
DBG("Connection state %i", state);
|
DBG("PA context fail.");
|
||||||
}
|
EINA_LIST_FOREACH(class_vars.outputs, out, eo_obj) {
|
||||||
|
eo_do(eo_obj, eo_event_callback_call(ECORE_AUDIO_EV_OUT_PULSE_CONTEXT_FAIL, NULL, NULL));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
DBG("Connection state %i", state);
|
||||||
|
}
|
||||||
|
// now unref everything safely
|
||||||
|
EINA_LIST_FOREACH_SAFE(class_vars.outputs, out, tmp, eo_obj) {
|
||||||
|
eo_unref(eo_obj);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void _state_job(void *data EINA_UNUSED)
|
static void _state_job(void *data EINA_UNUSED)
|
||||||
|
|
Loading…
Reference in New Issue