[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSPopUpButtonCell (was: Disappointed by GNUstep)

From: Sergei Golovin
Subject: Re: NSPopUpButtonCell (was: Disappointed by GNUstep)
Date: Wed, 09 Feb 2022 07:46:08 +0400
User-agent: GNUMail (Version 1.3.0)

On 2022-02-08 21:35:55 +0400 Wolfgang Lux <> wrote:

_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 . :-(

I also thought along that line initially but NSPopUpButtonCell retains _menu in its own

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.

The method -[setMenu:] moves from a state with menuA to a state with menuB. The -[deallloc] is special. It should take the current state, clear it and go to void.

Besides that there is no point to have _menu == nil somewhere in a running application
except for initialization and deallocation.
An empty menu should be of NSMenu anyway, not nil. So instead
of the call -[setMenu: nil] (illegitimate in my opinion) only a bunch of -[release] is required to avoid leaking (as you suggested/pointed out). May be something like -[clear] to do things
I overlooked.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]