NSPopUpButtonCell (was: Disappointed by GNUstep)

Wolfgang Lux <[email protected]> Tue, 8 Feb 2022 18:35:55 +0100
Newsgroups gmane.comp.lib.gnustep.devel
Message-ID <[email protected]>

> Am 08.02.2022 um 04:16 schrieb Sergei Golovin <[email protected]>:
> 
> On 2022-02-08 02:49:26 +0400 Wolfgang Lux <[email protected]> wrote:
> 
>>> The attached patch changes the -[dealloc] to do the code chunk equivalent to -[setMenu:nil]
>>> avoiding that -[NSPopUpButtonCell synchronizeTitleAndSelectedItem]
>>> and following.
>> didn't have time to look at your second message earlier.
>> I like the idea of avoiding the call to setMenu: altogether. That said,
>> there is a little problem with your patch: It lets the menu leak. There
>> should be a DESTROY(_menu) or RELEASE(_menu) statement after removing
>> the observer.
> 
> _menu is owned by a superclass and released there. See -[NSCell dealloc].

Doh, you are right.
I somehow convinced myself into believing that _menu was an instance variable of NSPopUpButtonCell. :-(
Now what is confusing me is that by applying your patch we are full circle back to before b7f5fb2, which had added the call to setMenu: to the dealloc method in the first place. According to the log this was done in an attempt to fix a leak of the menu. It feels like I'm missing something here.

Wolfgang