Re: menu madness with retain count
Re: menu madness with retain count
- Subject: Re: menu madness with retain count
- From: Fritz Anderson <email@hidden>
- Date: Tue, 27 Apr 2010 11:32:49 -0500
On 27 Apr 2010, at 10:28 AM, Bill Appleton wrote:
> 1) 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
>
> 2) 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
>
> 3) 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?
The "ownership" metaphor has this defect: It's not like property, which has only one owner at a time. The concept is, instead, "I need to keep a claim on this object, so it doesn't go away without my saying I'm done with it."
So -release doesn't _give_ ownership of the object to anything else. The "anything else" uses -retain or creation to _take_ ownership (maybe think of it as "responsibility") for the object if it is interested in it.
— F
_______________________________________________
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