[vlc-devel] commit: Fixed a deadlock between ressources freeing and playlist through gui. ( Laurent Aimar )
git version control
git at videolan.org
Sat Jan 24 11:30:33 CET 2009
vlc | branch: master | Laurent Aimar <fenrir at videolan.org> | Sat Jan 24 11:17:20 2009 +0100| [982f3e4204f48c955549c075d8f416f3192ed0d0] | committer: Laurent Aimar
Fixed a deadlock between ressources freeing and playlist through gui.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=982f3e4204f48c955549c075d8f416f3192ed0d0
---
src/playlist/thread.c | 30 +++++++++++++++++++++++-------
1 files changed, 23 insertions(+), 7 deletions(-)
diff --git a/src/playlist/thread.c b/src/playlist/thread.c
index b2ad676..3005793 100644
--- a/src/playlist/thread.c
+++ b/src/playlist/thread.c
@@ -484,13 +484,17 @@ static int LoopInput( playlist_t *p_playlist )
assert( p_sys->p_input_ressource == NULL );
p_sys->p_input_ressource = input_DetachRessource( p_input );
+
+ PL_UNLOCK;
+ /* We can unlock as we return VLC_EGENERIC (no event will be lost) */
+
+ /* input_ressource_t must be manipulated without playlist lock */
if( !var_CreateGetBool( p_input, "sout-keep" ) )
input_ressource_TerminateSout( p_sys->p_input_ressource );
- /* The DelCallback must be issued without playlist lock
- * It is not a problem as we return VLC_EGENERIC */
- PL_UNLOCK;
+ /* The DelCallback must be issued without playlist lock */
var_DelCallback( p_input, "intf-event", InputEvent, p_playlist );
+
PL_LOCK;
p_sys->p_input = NULL;
@@ -533,12 +537,24 @@ static void LoopRequest( playlist_t *p_playlist )
{
p_sys->status.i_status = PLAYLIST_STOPPED;
- if( p_sys->p_input_ressource )
+ if( p_sys->p_input_ressource &&
+ input_ressource_HasVout( p_sys->p_input_ressource ) )
+ {
+ /* XXX We can unlock if we don't issue the wait as we will be
+ * call again without anything else done between the calls */
+ PL_UNLOCK;
+
+ /* input_ressource_t must be manipulated without playlist lock */
input_ressource_TerminateVout( p_sys->p_input_ressource );
- if( vlc_object_alive( p_playlist ) )
- vlc_cond_wait( &pl_priv(p_playlist)->signal,
- &vlc_internals(p_playlist)->lock );
+ PL_LOCK;
+ }
+ else
+ {
+ if( vlc_object_alive( p_playlist ) )
+ vlc_cond_wait( &pl_priv(p_playlist)->signal,
+ &vlc_internals(p_playlist)->lock );
+ }
return;
}
More information about the vlc-devel
mailing list