On 2022-02-08 21:35:55 +0400 Wolfgang Lux <wolfgang....@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