if ( p_temp_item )
{
+ vlc_mutex_lock( &p_playlist->object_lock );
while( p_temp_item->i_parents > 0 )
{
int i;
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
}
}
}
+ vlc_mutex_unlock( &p_playlist->object_lock );
}
vlc_object_release( p_playlist );
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 );
/* 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 );
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;
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 )
{
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