[vlc-devel] 1.0.0 OSX object leaks

Pierre d'Herbemont pdherbemont at free.fr
Fri Apr 3 13:17:08 CEST 2009


On Fri, Apr 3, 2009 at 1:58 AM, Derk-Jan Hartman <hartman at videolan.org> wrote:
>
> On 3 apr 2009, at 01:42, Derk-Jan Hartman wrote:
>
>> I'm not sure how many people are aware, but there is a large amount of
>> object leaks in the OSX gui. I was looking at the generated leaklist today,
>> and suddenly realized that there was a pattern. The pattern is that these
>> are all objects used by setupVarMenuItem. I tested by inserting an immediate
>> return in this function, and I can confirm that this seems to avoid the
>> object leaks.
>
> More specific. Autogenerated menu's have:
> [o_mi setRepresentedObject: [NSValue valueWithPointer:[o_data retain]]];
>
> But that object is never destroyed and thus the dealloc of
> VLCAutoGeneratedMenuContent is never called and thus vlc_object_release is
> not called.
> That's a big oops we have there. We need to check for any existing
> representedObject's and release them. Sounds like a nice little task for
> tomorrow.

Well, in the first place why is an NSValue used here? In this case we
already have an objc object, so no need to encapsulate it in a
NSValue.

Moreover, there is a clear abuse of NSValue usage in gui/macosx. We'd
better have a subclass of NSObject to encapsulate the different VLC
objects. Hence refcounting can be bridged.

Pierre.



More information about the vlc-devel mailing list