Changeset 24298341eb3b322f6f4eba55ff8b58399890c72e

Show
Ignore:
Timestamp:
06/07/08 15:46:16 (5 months ago)
Author:
Pierre d'Herbemont <pdherbemont@videolan.org>
git-committer:
Pierre d'Herbemont <pdherbemont@videolan.org> 1215351976 +0200
git-parent:

[c8759b8d6ca419b3bc6f157da5eae0093a145435]

git-author:
Pierre d'Herbemont <pdherbemont@videolan.org> 1215341164 +0200
Message:

playlist: Make sure we don't crash when we delete the currently playing node.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • src/playlist/control.c

    r89e10b6 r2429834  
    374374                        PLI_NAME( p_playlist->request.p_node ), i_skip ); 
    375375 
     376        /* Make sure the node wasn't deleted */ 
     377        if( p_playlist->status.p_node && 
     378            p_playlist->status.p_node->i_flags & PLAYLIST_REMOVE_FLAG ) 
     379        { 
     380             PL_DEBUG( "%s was marked for deletion, deleting", 
     381                             PLI_NAME( p_playlist->status.p_node  ) ); 
     382             playlist_ItemDelete( p_playlist->status.p_node ); 
     383             /* Don't attempt to reuse that node */ 
     384             if( p_playlist->status.p_node == p_playlist->request.p_node ) 
     385                p_playlist->request.p_node = NULL; 
     386             p_playlist->status.p_node = NULL; 
     387        } 
     388 
    376389        if( p_playlist->request.p_node && 
    377390            p_playlist->request.p_node != p_playlist->status.p_node ) 
    378391        { 
     392 
    379393            p_playlist->status.p_node = p_playlist->request.p_node; 
    380394            p_playlist->b_reset_currently_playing = true; 
  • src/playlist/engine.c

    r89e10b6 r2429834  
    477477        sout_DeleteInstance( p_sout ); 
    478478#endif 
     479 
     480    if( p_playlist->status.p_node && 
     481        p_playlist->status.p_node->i_flags & PLAYLIST_REMOVE_FLAG ) 
     482    { 
     483         PL_DEBUG( "%s was marked for deletion, deleting", 
     484                         PLI_NAME( p_playlist->status.p_node  ) ); 
     485         playlist_ItemDelete( p_playlist->status.p_node ); 
     486         p_playlist->status.p_node = NULL; 
     487    } 
    479488 
    480489    /* Core should have terminated all SDs before the playlist */ 
  • src/playlist/tree.c

    rd666030 r2429834  
    172172            playlist_NodeRemoveItem( p_playlist, p_root, p_root->p_parent ); 
    173173 
    174         playlist_ItemDelete( p_root ); 
     174        /* Check if it is the current node */ 
     175        if( p_playlist->status.p_node == p_root ) 
     176        { 
     177            /* Hack we don't call playlist_Control for lock reasons */ 
     178            p_playlist->request.i_status = PLAYLIST_STOPPED; 
     179            p_playlist->request.b_request = true; 
     180            p_playlist->request.p_item = NULL; 
     181            p_playlist->request.p_node = NULL; 
     182            msg_Info( p_playlist, "stopping playback" ); 
     183            vlc_object_signal_maybe( VLC_OBJECT(p_playlist) ); 
     184 
     185            PL_DEBUG( "marking %s for further deletion", PLI_NAME( p_root ) ); 
     186            p_root->i_flags |= PLAYLIST_REMOVE_FLAG; 
     187        } 
     188        else 
     189            playlist_ItemDelete( p_root ); 
     190 
     191 
    175192    } 
    176193    return VLC_SUCCESS;