Fix #1487 - race condition
authorRafaël Carré <funman@videolan.org>
Tue, 6 May 2008 21:55:58 +0000 (23:55 +0200)
committerRafaël Carré <funman@videolan.org>
Tue, 6 May 2008 21:56:16 +0000 (23:56 +0200)
src/playlist/control.c
src/playlist/engine.c

index d07f5d1..bbaa74b 100644 (file)
@@ -437,6 +437,7 @@ playlist_item_t * playlist_NextItem( playlist_t *p_playlist )
                                    p_playlist->status.p_item );
 
         p_playlist->i_current_index++;
+        assert( p_playlist->i_current_index <= p_playlist->current.i_size );
         if( p_playlist->i_current_index == p_playlist->current.i_size )
         {
             if( !b_loop || p_playlist->current.i_size == 0 ) return NULL;
index f39f603..5e0cecd 100644 (file)
@@ -352,7 +352,9 @@ check_input:
          *  - Request, running requested -> start new item
          *  - Request, stopped requested -> collect garbage
         */
-        if( p_playlist->request.i_status != PLAYLIST_STOPPED )
+        int i_status = p_playlist->request.b_request ?
+            p_playlist->request.i_status : p_playlist->status.i_status;
+        if( i_status != PLAYLIST_STOPPED )
         {
             msg_Dbg( p_playlist, "starting new item" );
             p_item = playlist_NextItem( p_playlist );