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

Rémi Denis-Courmont remi at remlab.net
Thu Feb 23 23:04:46 CET 2017

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.

For a proper fix, we would need to stop mixing vlc_object_t proper and 
vlc_object_t containers like they are the same thing. (Compare 'struct device' 
in the kernel.)

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.


More information about the vlc-devel mailing list