Re: storage for context: value
Re: storage for context: value
- Subject: Re: storage for context: value
- From: Scott Ribe <email@hidden>
- Date: Thu, 25 Jul 2013 09:12:12 -0600
On Jul 25, 2013, at 8:50 AM, Matt Neuburg <email@hidden> wrote:
> But surely that can't work, since you set up the call once but you can get called back many times - or am I misunderstanding? m.
Sorry, that depends on the callback, and I was thinking specifically of one-shot ones. (Think of beginSheetModalForWindow…)
Where the callback has an indefinite lifetime, then yes, the release must be handled somewhere else. But the basic point still applies, if you release the context info only at the point where you deactivate the callback, you're good--and yes I've done that too.
Of course another way is to have an object that owns both the callback and related info, that instantiates the callback and passes itself as the context info, and deactivates the callback and releases the related info at the same time.
Regardless, you need simple & clear & consistent single points of construction & destruction of the information.
--
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