Commit 4bd079da authored by Jean-Paul Saman's avatar Jean-Paul Saman

Add some sanity checking and extra locking to guard against concurrent access patterns in core.

parent 65382e4f
......@@ -406,6 +406,8 @@ void input_StopThread( input_thread_t *p_input )
*/
void input_DestroyThread( input_thread_t *p_input )
{
if( p_input )
{
/* Join the thread */
vlc_thread_join( p_input );
......@@ -414,6 +416,7 @@ void input_DestroyThread( input_thread_t *p_input )
/* TODO: maybe input_DestroyThread should also delete p_input instead
* of the playlist but I'm not sure if it's possible */
}
}
/*****************************************************************************
......@@ -423,13 +426,13 @@ void input_DestroyThread( input_thread_t *p_input )
*****************************************************************************/
static int Run( input_thread_t *p_input )
{
/* Signal that the thread is launched */
vlc_thread_ready( p_input );
if( Init( p_input, VLC_FALSE ) )
{
/* If we failed, wait before we are killed, and exit */
p_input->b_error = VLC_TRUE;
/* Signal that the thread is launched */
Error( p_input );
......
......@@ -734,7 +734,7 @@ int playlist_Clear( playlist_t * p_playlist )
int i;
for( i = p_playlist->i_size; i > 0 ; i-- )
{
playlist_Delete( p_playlist, p_playlist->pp_items[0]->input.i_id );
playlist_LockDelete( p_playlist, p_playlist->pp_items[0]->input.i_id );
}
for( i = 0 ; i< p_playlist->i_views; i++ )
{
......
......@@ -657,6 +657,8 @@ static void RunThread ( playlist_t *p_playlist )
/* Destroy input */
input_DestroyThread( p_input );
vlc_mutex_lock( &p_playlist->object_lock );
/* Unlink current input
* (_after_ input_DestroyThread for vout garbage collector) */
vlc_object_detach( p_input );
......@@ -796,6 +798,9 @@ static void RunThread ( playlist_t *p_playlist )
/* Destroy input */
input_DestroyThread( p_input );
vlc_mutex_lock( &p_playlist->object_lock );
/* Unlink current input (_after_ input_DestroyThread for vout
* garbage collector)*/
vlc_object_detach( p_input );
......
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