• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Can I call unbind: in finalize? Is it thread safe?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

References: 
 >Can I call unbind: in finalize? Is it thread safe? (From: "Sean McBride" <email@hidden>)
 >Re: Can I call unbind: in finalize? Is it thread safe? (From: Ron Lue-Sang <email@hidden>)

  • Prev by Date: Re: Custom tracking in a NSTextFieldCell
  • Next by Date: Re: Returning value from detached NSThread selector with multiple arguments.
  • Previous by thread: Re: Can I call unbind: in finalize? Is it thread safe?
  • Next by thread: Re: Can I call unbind: in finalize? Is it thread safe?
  • Index(es):
    • Date
    • Thread