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:12:07 -0500
- Organization: Rogue Research Inc.
On 1/7/09 10:12 PM, Kyle Sluder said:
>> When do AppKit views call unbind:?
>
>You say you're familiar with mmalc's recommendations... but this
>question is explicitly addressed in the "Unbinding" section. I assume
>you want to call -unbind: so as to remove your view from observing a
>controller (doing it "for cleanliness sake" is useless; bindings are
>essentially UI design conveniences for KVO). Call -unbind: in
>-viewWillMoveToSuperview: (as long as the view doesn't become
>fullscreen).
It was me that pointed out the fullscreen problems to mmalc. :) An
NSView has no control over whether its caller will decide to make it
fullscreen or not, so the viewWillMoveToSuperview solution isn't ideal.
>http://homepage.mac.com/mmalc/CocoaExamples/controllers.html#unbinding
>
>As for whether it's thread safe, I would say no, because Cocoa
>Bindings in general is not thread safe. See Chris Hanson's post on
>the topic: http://chanson.livejournal.com/2005/07/23/
I'm inclined to agree. However, mmalc's page says "If your view may
become full screen, then you should ideally use another invalidation
method to mark when the view is finished with and unbind in that,
otherwise you should unbind in finalize".
So if not finalize and not viewWillMoveToSuperview, when can I stop the
observing I started in bind:? That's what I'm trying to get at really.
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