Re: Can I call unbind: in finalize? Is it thread safe?
Re: Can I call unbind: in finalize? Is it thread safe?
- Subject: Re: Can I call unbind: in finalize? Is it thread safe?
- From: "Sean McBride" <email@hidden>
- Date: Thu, 8 Jan 2009 11:02:47 -0500
- Organization: Rogue Research Inc.
On 1/7/09 2:25 PM, Ron Lue-Sang said:
>You don't need to call unbind: from finalize.
>
>If you're an observer of some other object, and you haven't removed
>yourself as an observer by the time you're in finalize... well, try to
>clean up any observing by the time you hit finalize.
>
>> When do AppKit views call unbind:?
>
>Most views, currently, don't call unbind: on themselves at all.
Ronzilla,
Thanks for your reply.
So if in my implementation of bind:toObject:withKeyPath:options: I add
myself as an observer, when is the correct time to remove myself as an
observer?
This example:
<http://developer.apple.com/samplecode/BindingsJoystick/listing4.html>
a) overrides unbind: and calls removeObserver there. Is that correct?
b) calls unbind: from dealloc. Is that correct?
c) in GC, assuming a client does not unbind: manually, when is the right
time to stop the observations started in bind:?
Cheers,
--
____________________________________________________________
Sean McBride, B. Eng email@hidden
Rogue Research www.rogue-research.com
Mac Software Developer Montréal, Québec, Canada
_______________________________________________
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