gnustep-dev
[Top][All Lists]
Advanced

[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 <wolfgang.lux@gmail.com> 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
-[setMenu:].

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.

https://github.com/gnustep/libs-gui/pull/137

--
SG




--
SG



reply via email to

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