Commit 948676af authored by zorglub's avatar zorglub

Fix for deletion of current item

parent 9e11182b
......@@ -464,4 +464,6 @@ static inline vlc_bool_t playlist_IsEmpty( playlist_t * p_playlist )
#define PL_DEBUG( msg, args ... ) {}
#endif
#define PLI_NAME( p ) p ? p->p_input->psz_name : "null"
#endif
......@@ -76,6 +76,7 @@ static void vlc_input_item_Destroy ( gc_object_t *p_this )
playlist_t *p_playlist = (playlist_t *)vlc_object_find( p_obj,
VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
fprintf( stderr, "Destroying %s\n", p_input->psz_name );
vlc_input_item_Clean( p_input );
if( p_playlist )
......
......@@ -327,7 +327,9 @@ playlist_item_t * playlist_NextItem( playlist_t *p_playlist )
/* Start the real work */
if( p_playlist->request.b_request )
{
PL_DEBUG( "processing request" );
PL_DEBUG( "processing request node %s item %s skip %i",
PLI_NAME( p_playlist->request.p_item ),
PLI_NAME( p_playlist->request.p_node ), i_skip );
p_new = p_playlist->request.p_item;
i_skip = p_playlist->request.i_skip;
......
......@@ -223,6 +223,7 @@ void playlist_MainLoop( playlist_t *p_playlist )
{
int i_activity;
input_thread_t *p_input;
PL_DEBUG( "dead input" );
p_input = p_playlist->p_input;
p_playlist->p_input = NULL;
......@@ -247,6 +248,8 @@ void playlist_MainLoop( playlist_t *p_playlist )
if( p_playlist->status.p_item->i_flags
& PLAYLIST_REMOVE_FLAG )
{
PL_DEBUG( "%s was marked for deletion, deleting",
PLI_NAME( p_playlist->status.p_item ) );
playlist_ItemDelete( p_playlist->status.p_item );
if( p_playlist->request.p_item == p_playlist->status.p_item )
p_playlist->request.p_item = NULL;
......@@ -262,12 +265,13 @@ void playlist_MainLoop( playlist_t *p_playlist )
/* This input is dying, let it do */
else if( p_playlist->p_input->b_die )
{
;
PL_DEBUG( "dying input" );
}
/* This input has finished, ask it to die ! */
else if( p_playlist->p_input->b_error
|| p_playlist->p_input->b_eof )
{
PL_DEBUG( "finished input" );
input_StopThread( p_playlist->p_input );
/* Select the next playlist item */
PL_UNLOCK
......@@ -275,7 +279,7 @@ void playlist_MainLoop( playlist_t *p_playlist )
}
else if( p_playlist->p_input->i_state != INIT_S )
{
PL_UNLOCK
PL_UNLOCK;
p_playlist->i_vout_destroyed_date =
ObjectGarbageCollector( p_playlist, VLC_OBJECT_VOUT,
p_playlist->i_vout_destroyed_date );
......@@ -298,7 +302,7 @@ void playlist_MainLoop( playlist_t *p_playlist )
( p_playlist->request.b_request &&
p_playlist->request.i_status != PLAYLIST_STOPPED ) )
{
msg_Dbg( p_playlist, "Starting new item" );
msg_Dbg( p_playlist, "starting new item" );
stats_TimerStart( p_playlist, "Playlist walk",
STATS_TIMER_PLAYLIST_WALK );
p_item = playlist_NextItem( p_playlist );
......@@ -315,10 +319,11 @@ void playlist_MainLoop( playlist_t *p_playlist )
}
else
{
if( p_item && p_playlist->status.p_item &&
if( p_playlist->status.p_item &&
p_playlist->status.p_item->i_flags & PLAYLIST_REMOVE_FLAG )
{
playlist_ItemDelete( p_item );
PL_DEBUG( "deleting item marked for deletion" );
playlist_ItemDelete( p_playlist->status.p_item );
p_playlist->status.p_item = NULL;
}
......
......@@ -632,7 +632,7 @@ int DeleteInner( playlist_t * p_playlist, playlist_item_t *p_item,
/* Hack we don't call playlist_Control for lock reasons */
if( b_stop )
{
p_playlist->status.i_status = PLAYLIST_STOPPED;
p_playlist->request.i_status = PLAYLIST_STOPPED;
p_playlist->request.b_request = VLC_TRUE;
p_playlist->request.p_item = NULL;
msg_Info( p_playlist, "stopping playback" );
......@@ -648,7 +648,10 @@ int DeleteInner( playlist_t * p_playlist, playlist_item_t *p_item,
if( b_flag == VLC_FALSE )
playlist_ItemDelete( p_item );
else
{
PL_DEBUG( "marking %s for further deletion", PLI_NAME( p_item ) );
p_item->i_flags |= PLAYLIST_REMOVE_FLAG;
}
return VLC_SUCCESS;
}
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