[vlc-devel] [RFC] Send warning on bad vlc_object_(hold|warning) usage

Pierre d'Herbemont pdherbemont at gmail.com
Wed Sep 16 11:39:57 CEST 2009


On Sep 16, 2009, at 11:23 AM, Rémi Denis-Courmont wrote:

>
> On Wed, 16 Sep 2009 10:14:35 +0200, Pierre d'Herbemont
> <pdherbemont at gmail.com> wrote:
>> As discussed on this mailing list, this API is working on a subclass
>> basis, and only hold the vlc_object_t data, and may return invalid
>> subclass data.
>
> Holding or releasing a sub-classed object is perfectly valid.  
> Changing the
> return type of _hold looks OK to me, but not the rest.

It is valid, but it's error prone because of its name. That what I was  
trying to address.

> Ideally, we would kill VLC_COMMOM_MEMBERS, and include the  
> vlc_object_t
> structure into each and every object class. That would be the same  
> pattern
> as, e.g., Linux kernel objects, or VLC garbage collector. Then, we  
> could
> actually fix the VLC_OBJECT() macro. It currently fails to ensure that
> VLC_COMMOM_MEMBERS is at the right offset (zero) from the cast  
> pointer. I
> have no time for this though.

I like this approach. It would probably make it more explicit that  
this is not a super class. (If this is reflected on the API as well.).

Thanks,

Pierre.




More information about the vlc-devel mailing list