Commit 21702e21 authored by Pierre d'Herbemont's avatar Pierre d'Herbemont
Browse files

playlist: Make sure fetcher and preparser won't miss a vlc_object_kill().

parent 449e7059
...@@ -483,9 +483,10 @@ void playlist_PreparseLoop( playlist_preparse_t *p_obj ) ...@@ -483,9 +483,10 @@ void playlist_PreparseLoop( playlist_preparse_t *p_obj )
input_item_t *p_current; input_item_t *p_current;
int i_activity; int i_activity;
while( !p_playlist->b_die ) vlc_object_lock( p_obj );
while( vlc_object_alive( p_obj ) )
{ {
vlc_object_lock( p_obj );
while( p_obj->i_waiting == 0 ) while( p_obj->i_waiting == 0 )
{ {
if( vlc_object_wait( p_obj ) || p_playlist->b_die ) if( vlc_object_wait( p_obj ) || p_playlist->b_die )
...@@ -556,7 +557,9 @@ void playlist_PreparseLoop( playlist_preparse_t *p_obj ) ...@@ -556,7 +557,9 @@ void playlist_PreparseLoop( playlist_preparse_t *p_obj )
vlc_object_unlock( p_obj ); vlc_object_unlock( p_obj );
/* Sleep at least 1ms */ /* Sleep at least 1ms */
msleep( (i_activity+1) * 1000 ); msleep( (i_activity+1) * 1000 );
vlc_object_lock( p_obj );
} }
vlc_object_unlock( p_obj );
} }
/** /**
...@@ -572,13 +575,13 @@ void playlist_FetcherLoop( playlist_fetcher_t *p_obj ) ...@@ -572,13 +575,13 @@ void playlist_FetcherLoop( playlist_fetcher_t *p_obj )
input_item_t *p_item; input_item_t *p_item;
int i_activity; int i_activity;
while( !p_playlist->b_die ) vlc_mutex_lock( &p_obj->object_lock );
while( vlc_object_alive( p_obj ) )
{ {
vlc_mutex_lock( &p_obj->object_lock );
while( p_obj->i_waiting == 0 ) while( p_obj->i_waiting == 0 )
{ {
vlc_cond_wait( &p_obj->object_wait, &p_obj->object_lock ); if( vlc_object_wait( p_obj ) || p_playlist->b_die )
if( p_playlist->b_die )
{ {
vlc_mutex_unlock( &p_obj->object_lock ); vlc_mutex_unlock( &p_obj->object_lock );
return; return;
...@@ -638,7 +641,9 @@ void playlist_FetcherLoop( playlist_fetcher_t *p_obj ) ...@@ -638,7 +641,9 @@ void playlist_FetcherLoop( playlist_fetcher_t *p_obj )
vlc_object_unlock( p_obj ); vlc_object_unlock( p_obj );
/* Sleep at least 1ms */ /* Sleep at least 1ms */
msleep( (i_activity+1) * 1000 ); msleep( (i_activity+1) * 1000 );
vlc_mutex_lock( &p_obj->object_lock );
} }
vlc_mutex_unlock( &p_obj->object_lock );
} }
static void VariablesInit( playlist_t *p_playlist ) static void VariablesInit( playlist_t *p_playlist )
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment