Re: menu madness with retain count
Re: menu madness with retain count
- Subject: Re: menu madness with retain count
- From: Scott Ribe <email@hidden>
- Date: Tue, 27 Apr 2010 11:20:30 -0600
On Apr 27, 2010, at 9:28 AM, Bill Appleton wrote:
> after i append an item i have created to a menu i have created, and i
> don't want to own the menu item any more, i should release the item so that
> the menu owns it
Probably not, but it depends on how you created it. If you created it with a convenience method, then you don't own it and don't need to release it (unless you retained it). If you created it via [[... alloc] init...] then you own it and need to release it.
> when i add a submenu i have created to a menu i have created, and i don't
> want to own the submenu any more, i should release the submenu so that the
> menu owns it
Same answer as above.
> when i set the menus i have created for NSApp using setMainMenu then...
> what? who owns them? how do i set more menus for NSApp? how do i get NSApp
> to release the current set?
Presumably, NSApp will take ownership of the menu when you set the main menu, and give up ownership of the prior main menu. Menus in turn own their items.
Now, given the first two answers, maybe this will start to make more sense:
<http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/MemoryMgmt/Articles/mmRules.html>
--
Scott Ribe
email@hidden
http://www.elevated-dev.com/
(303) 722-0567 voice
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please 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