[vlc-devel] [PATCH 16/18] gui/qt: fix #17184 (missing entries in context-menu)

Francois Cartegnie fcvlcdev at free.fr
Wed Jul 20 11:25:41 CEST 2016


Le 20/07/2016 à 04:37, Filip Roséen a écrit :
> This patch fixes the regression where certain entities on the
> context-menu when dealing with the playlist are not displayed if you
> right-click somewhere where there is no item:
> 
>     - https://trac.videolan.org/vlc/ticket/17184
> 
> Actions that are not bound to a single entity are now displayed
> correctly (vlc 2.2.4 has been used as reference), with two minor
> differences:
> 
>     * ACTION_PAUSE will now be shown if the current item is being
>       played, and;
> 
>     * ACTION_PLAY will not show if the item is already playing.
> 


> -    if( !index.isValid() )
> -        return false;
> -
> -    const PLItem *item = getItem( index );
> +    vlc_playlist_locker pl_lock ( THEPL );
> +        
> +    bool const b_readonly = THEPL->p_root->i_flags & PLAYLIST_RO_FLAG;
> +    AbstractPLItem * item = VLCModel::getItem( index );

And then you introduce NULL deref in most cases.


> +        case ACTION_EXPLORE:
> +        {
> +            return getURI( index ).startsWith( "file:///" );
> +        }

You changed scheme without reason.

> +        case ACTION_RENAMENODE:
> +        {
> +            if( index == rootIndex() || item == NULL )
> +                return false;
> +
> +            input_item_t* p_iitem = item->inputItem();
> +
> +            if( p_iitem == NULL )
> +                return false;
> +
> +            return p_iitem->i_type == ITEM_TYPE_NODE
> +                || p_iitem->i_type == ITEM_TYPE_DIRECTORY;
> +        }

You removed readonly cases.
You're not allowed to rename readonly nodes.

Does not sound fully tested.

Francois


More information about the vlc-devel mailing list