misc/events.c: We do want to send events to multiple listener. (oops, I should get...
authorPierre d'Herbemont <pdherbemont@videolan.org>
Fri, 17 Aug 2007 09:11:18 +0000 (09:11 +0000)
committerPierre d'Herbemont <pdherbemont@videolan.org>
Fri, 17 Aug 2007 09:11:18 +0000 (09:11 +0000)
src/misc/events.c

index 0850ba3..cb3e921 100644 (file)
@@ -141,13 +141,17 @@ void vlc_event_send( vlc_event_manager_t * p_em,
             FOREACH_ARRAY( listener, listeners_group->listeners )
                 func = listener->pf_callback;
                 user_data = listener->p_user_data;
+                /* This is safe to do that because we are sure 
+                 * that there will be no object owned references
+                 * used after the lock. */
+                vlc_mutex_unlock( &p_em->object_lock );
+                func( p_event, user_data );
+                vlc_mutex_lock( &p_em->object_lock );
             FOREACH_END()
             break;
         }
     FOREACH_END()
     vlc_mutex_unlock( &p_em->object_lock );
-    if( func )
-        func( p_event, user_data );
 }
 
 /**