[vlc-devel] [PATCH 7/8] playlist: forcefully delete children of writable parent

Rémi Denis-Courmont remi at remlab.net
Sun May 21 21:19:50 CEST 2017


Le sunnuntaina 21. toukokuuta 2017, 20.48.17 EEST Filip Roséen a écrit :
> If a parent is writable, but has read-only children, the previous
> implementation would not delete the children, while deletion of the
> parent would go through.
> 
> Which would, of course, result in a leak of the children in question.

I think that this case should never happen; and it would not make much sense 
if it did. Did you actually hit such a situation?

> ---
>  src/playlist/tree.c | 9 +++++----
>  1 file changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/src/playlist/tree.c b/src/playlist/tree.c
> index 8358932622..891be5456f 100644
> --- a/src/playlist/tree.c
> +++ b/src/playlist/tree.c
> @@ -100,15 +100,16 @@ void playlist_NodeDeleteExplicit( playlist_t
> *p_playlist, {
>      PL_ASSERT_LOCKED;
> 
> -    /* Delete the children */
> -    for( int i = p_root->i_children - 1 ; i >= 0; i-- )
> -        playlist_NodeDeleteExplicit( p_playlist, p_root->pp_children[i],
> flags ); -
>      /* Delete the node */
>      if( p_root->i_flags & PLAYLIST_RO_FLAG &&
>          !( flags & PLAYLIST_DELETE_FORCE ) )
>          return;
> 
> +    /* Delete the children */
> +    for( int i = p_root->i_children - 1 ; i >= 0; i-- )
> +        playlist_NodeDeleteExplicit( p_playlist,
> +            p_root->pp_children[i], flags | PLAYLIST_DELETE_FORCE );
> +
>      pl_priv(p_playlist)->b_reset_currently_playing = true;
> 
>      int i;


-- 
雷米‧德尼-库尔蒙
https://www.remlab.net/



More information about the vlc-devel mailing list