[vlc-devel] [PATCH] gui/qt: menus: do not use VLC_OBJECT on NULL

Filip Roséen filip at atch.se
Thu Feb 23 15:25:48 CET 2017


Hi j-b,

Resending this message (a little revised) as I accidentally replied to
you personally, and not `vlc-devel`.

On 2017-02-23 15:00, Jean-Baptiste Kempf wrote:

> Hello,
> 
> On Thu, 23 Feb 2017, at 14:54, Filip Roséen wrote:
> > -        objects.append(VLC_OBJECT(object)); \
> > +        objects.append(object ? VLC_OBJECT(object) : NULL); \
> 
> Why is that better than
> if (object) objects.append ?

Because there is an invisible relationship between the variables named
`objects`, and `varnames` (where `varnames[i]` and `objects[i]` belong
together).

This should be refactored in the future to use a container with
`std::pair<T1,T2>` or `QPair<T1,T2>` - though I just wanted to fix the
immediate issue now (as the refactor would be quite intrusive).

Best Regards,
Filip
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20170223/f9c98a19/attachment.html>


More information about the vlc-devel mailing list