[vlc-devel] [PATCH v4 2/3] Update media tree on browsing/preparsing

Rémi Denis-Courmont remi at remlab.net
Mon Jul 9 19:30:15 CEST 2018


Le maanantaina 9. heinäkuuta 2018, 15.38.51 EEST Romain Vimont a écrit :
> > +static input_item_node_t *AddChild(vlc_media_tree_t *tree,
> > input_item_node_t *parent, input_item_t *input); +
> > +static void AddSubtree(vlc_media_tree_t *tree, input_item_node_t *p_to,
> > input_item_node_t *p_from) +{
> > +    for(int i = 0; i < p_from->i_children; ++i)
> > +    {
> > +        input_item_node_t *p_child = p_from->pp_children[i];
> > +        input_item_node_t *node = AddChild(tree, p_to, p_child->p_item);
> > +        if (unlikely(!node))
> > +            abort(); /* what could we do? */
> 
> Just to highlight: this is wrong, but what should we do instead if the
> malloc fails?

Well... IME input item callbacks constitute the most broken bits of the 
playlist code. So I'd suggest devising a replacement for them, instead of 
worrying about how to handle this specific callback.

FWIW there is also an abort() in the AddListener within ARRAY_APPEND.

> This function is called by the callback input_item_subtree_added().
> (Also, since vlc_media_tree_t is not a vlc_object_t, we cannot easily
> log.)

-- 
Реми Дёни-Курмон
http://www.remlab.net/





More information about the vlc-devel mailing list