On Jul 25, 2013, at 8:50 AM, Matt Neuburg <m...@tidbits.com> 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
scott_r...@elevated-dev.com
http://www.elevated-dev.com/
(303) 722-0567 voice





_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to