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

Filip Roséen filip at atch.se
Fri Feb 24 00:09:12 CET 2017

Hi Rémi,

On 2017-02-24 00:18, Rémi Denis-Courmont wrote:

> Le perjantaina 24. helmikuuta 2017, 0.04.46 EET Rémi Denis-Courmont a écrit :
> > Le torstaina 23. helmikuuta 2017, 14.54.24 EET Filip Roséen a écrit :
> > > VLC_OBJECT reaches inside the data-members of the passed pointer to
> > > reach the intrinsic object, so that a pointer to the internal
> > > vlc_object_t can be created.
> > 
> > Yes but no. The result is the same however: the compiler assumes that the
> > pointer is not NULL.
> Actually yes. The C++ version does -technically- access the object, although 
> the C version does not. But at least, LLVM seems to barf also on the C 
> version; I suspect this is an LLVM bug though.

Yes, and given that the relevant snippet is always compiled as C++, it
does always *"technically"* dereference the pointer (and with that
invoke *undefined-behavior*).

As I guess is clear after our previous discussions I do not like doing
things that the relevant ISO Standard does not consider *well-defined*
(so "technically" is certainly good enough for me).

> > That said, in this case, you could probably either ensure that the object is 
> > always a vlc_object, or simply cast - to avoid the ternary.
> > [ src: https://mailman.videolan.org/pipermail/vlc-devel/2017-February/111657.html ]

I prefer the way the fix is currently written while we wait for a
refactored version that does not include these quirks at all. If the
patch is not satisfying enough for the VLC community, please discard

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

More information about the vlc-devel mailing list