raster pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=35228f32f189f90975729ca2dd0f3755f0e3db03

commit 35228f32f189f90975729ca2dd0f3755f0e3db03
Author: Carsten Haitzler (Rasterman) <[email protected]>
Date:   Sun Nov 10 11:04:18 2013 +0900

    ecore-audio - handle deletion of objects from outputs list in ctx fail cb
---
 src/lib/ecore_audio/ecore_audio_obj_out_pulse.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/src/lib/ecore_audio/ecore_audio_obj_out_pulse.c 
b/src/lib/ecore_audio/ecore_audio_obj_out_pulse.c
index 2c3f2ff..11fc20f 100644
--- a/src/lib/ecore_audio/ecore_audio_obj_out_pulse.c
+++ b/src/lib/ecore_audio/ecore_audio_obj_out_pulse.c
@@ -243,12 +243,21 @@ static void _state_job(void *data EINA_UNUSED)
        (class_vars.state == PA_CONTEXT_TERMINATED))
      {
         Eo *eo_obj;
-        Eina_List *out;
+        Eina_List *out, *tmp;
         
         DBG("PA context fail.");
+        //ref everything in the list to be sure...
+        EINA_LIST_FOREACH(class_vars.outputs, out, eo_obj) {
+           eo_ref(eo_obj);
+        }
+        // the callback here can delete things in the list..
         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));
         }
+        // now unref everything safely
+        EINA_LIST_FOREACH_SAFE(class_vars.outputs, out, tmp, eo_obj) {
+           eo_unref(eo_obj);
+        }
      }
    class_vars.state_job = NULL;
 }

-- 


Reply via email to