Re: Must remove submenu when dealloccing NSMenuItem?
Re: Must remove submenu when dealloccing NSMenuItem?
- Subject: Re: Must remove submenu when dealloccing NSMenuItem?
- From: Andy Lee <email@hidden>
- Date: Thu, 22 Feb 2007 10:12:51 -0500
On Feb 21, 2007, at 10:03 PM, Jerry Krinock wrote:
CONCLUSION: I think this indicates a leak in Apple's implementation of
NSMenuItem; possibly that they retain the _submenu as an instance
variable,
but don't set it to nil during -dealloc. Either that, or they've
got a
retain cycle.
A hypothesis like this is a good candidate for a stripped-down test
app to isolate the problem. I stripped down the code you posted to
what I *thought* was the relevant code, and the SSMenus got dealloced
just fine.
I create all the submenus up front, not lazily. I don't know if that
or any other stuff I snipped out matters. If you'd like to start
adding back code to see if you can reproduce the problem, my quick
test is here:
http://homepage.mac.com/aglee/MenuScratch.tgz
I set the top-level menu to be the contextual menu of the "Kill My
Menu" button so you can see that it's been constructed as intended.
Click the button to cause the top-level menu to be dealloc'ed.
I'm off to work now... hope this helps.
--Andy
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden