]> git.sesse.net Git - vlc/commitdiff
Merge [11470],[11471],[11474] and [11475] - Closes: #205
authorClément Stenac <zorglub@videolan.org>
Mon, 20 Jun 2005 18:58:27 +0000 (18:58 +0000)
committerClément Stenac <zorglub@videolan.org>
Mon, 20 Jun 2005 18:58:27 +0000 (18:58 +0000)
modules/gui/macosx/playlist.m
src/playlist/item-ext.c
src/playlist/playlist.c
src/playlist/view.c

index 851a0601ff012c35307a0d7bb65436c1fc43d9e4..8674a4300346fc923503a81dd4ebf98c649a0c2a 100644 (file)
@@ -367,6 +367,7 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/
 
     if ( p_temp_item )
     {
+        vlc_mutex_lock( &p_playlist->object_lock );
         while( p_temp_item->i_parents > 0 )
         {
             int i;
@@ -377,6 +378,7 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/
                     if( p_temp_item->pp_parents[i]->p_parent == p_node )
                     {
                         vlc_object_release( p_playlist );
+                        vlc_mutex_unlock( &p_playlist->object_lock );
                         return YES;
                     }
                     else
@@ -387,6 +389,7 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/
                 }
             }
         }
+        vlc_mutex_unlock( &p_playlist->object_lock );
     }
 
     vlc_object_release( p_playlist );
index f2087be59b7acb631b10bd6698f528d83ca4c079..7a9434868b2b0f7b04c24c45fd7c9d690b258b20 100644 (file)
@@ -622,6 +622,7 @@ int playlist_Replace( playlist_t *p_playlist, playlist_item_t *p_olditem,
 int playlist_Delete( playlist_t * p_playlist, int i_id )
 {
     int i, i_top, i_bottom;
+    int i_pos;
     vlc_bool_t b_flag = VLC_FALSE;
 
     playlist_item_t *p_item = playlist_ItemGetById( p_playlist, i_id );
@@ -663,10 +664,19 @@ int playlist_Delete( playlist_t * p_playlist, int i_id )
         /* Hack we don't call playlist_Control for lock reasons */
         p_playlist->status.i_status = PLAYLIST_STOPPED;
         p_playlist->request.b_request = VLC_TRUE;
+        p_playlist->request.p_item = NULL;
         msg_Info( p_playlist, "stopping playback" );
         b_flag = VLC_TRUE;
     }
 
+    /* Get position and update index if needed */
+    i_pos = playlist_GetPositionById( p_playlist, i_id );
+
+    if( i_pos >= 0 && i_pos <= p_playlist->i_index )
+    {
+        p_playlist->i_index--;
+    }
+
     msg_Dbg( p_playlist, "deleting playlist item `%s'",
                           p_item->input.psz_name );
 
index 1c667fdf788595c7491301733664a6f47afb4477..10bdae5cbc46923568069c8efaf7ac9f38840c79 100644 (file)
@@ -332,7 +332,8 @@ int playlist_vaControl( playlist_t * p_playlist, int i_query, va_list args )
         i_view = (int)va_arg( args,int );
         p_node = (playlist_item_t *)va_arg( args, playlist_item_t * );
         p_item = (playlist_item_t *)va_arg( args, playlist_item_t * );
-        if ( p_node == NULL || p_item == NULL || p_item->input.psz_uri == NULL )
+        if ( p_node == NULL || (p_item != NULL && p_item->input.psz_uri
+                                                         == NULL ))
         {
             p_playlist->status.i_status = PLAYLIST_STOPPED;
             p_playlist->request.b_request = VLC_TRUE;
@@ -866,7 +867,7 @@ static playlist_item_t * NextItem( playlist_t *p_playlist )
             i_skip = p_playlist->request.i_skip;
             i_goto = p_playlist->request.i_goto;
 
-            if( p_playlist->i_index == -1 ) p_playlist->i_index = 0;
+            if( p_playlist->i_index < 0 ) p_playlist->i_index = 0;
             p_new = p_playlist->pp_items[p_playlist->i_index];
 
             if( i_goto >= 0  && i_goto < p_playlist->i_size )
index 1521c3fa545414661c103486abd0430d2b05bd24..8e5e2829771186b2c0ce22780a4a4f910c212466 100644 (file)
@@ -619,6 +619,8 @@ playlist_item_t *playlist_FindNextFromParent( playlist_t *p_playlist,
     {
         msg_Dbg( p_playlist, "finding something to play within %s -root %s",
                             p_node->input.psz_name, p_root->input.psz_name );
+        msg_Dbg( p_playlist, "%s has %i children",
+                            p_node->input.psz_name, p_node->i_children );
 
     }
 #endif