• 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: Right place to unobserve notifications in a document
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Right place to unobserve notifications in a document


  • Subject: Re: Right place to unobserve notifications in a document
  • From: "Joan Lluch (casa)" <email@hidden>
  • Date: Wed, 20 Aug 2008 16:58:10 +0200


Joan Lluch

El 20/08/2008, a las 16:05, Negm-Awad Amin escribió:


Am Mi,20.08.2008 um 15:37 schrieb Joan Lluch (casa):


I've been reading this thread and I don't understand it in the case of GC. Why don't you still have to remove the observer from the notification center when you are not longer using it. Even if it is held as a weak reference, it will still remain registered for receiving notifications, so what when the observer is eventually collected, won't the notification center continue sending messages to the observer as long as it remains registered to receive them?, Please clarify.
First I want to say, that I'm happy to have a thread on this list, which is not related to a concrete problem, but discusses a design. I like that. :-)

Second: As you read, *I* would prefer to unregister the observer explicitly. You can do this in -finalize, but I do not have to repeat the design problems with finalization. *I* wanted a delegate method or a defined method to be overwritten in a subclass (I mentioned -close) to do it explicitly, *before* destroying the object. You ask the wrong person …

Third, to your question: Weak references in GC – they have nothing to do with "retainless" weak references using RC – are nullified automatically. If you use GC the weak collection should be modified appropiate by the collector itself. So this might be no problem. (I didn't test it, because it is not my idea.)

I understand what is your preferred approach, which it is also what I would do. I can add to it that I even thought that you *have to* *always* unregister the observers when you have done with them. This is obviously true in RC environment, but this is apparently not true in the case of GC. This is the part I don't get. I would appreciate if someone would clarify it for me.

Joan Lluch


_______________________________________________

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


  • Follow-Ups:
    • Re: Right place to unobserve notifications in a document
      • From: Quincey Morris <email@hidden>
    • Re: Right place to unobserve notifications in a document
      • From: Negm-Awad Amin <email@hidden>
References: 
 >Right place to unobserve notifications in a document (From: Negm-Awad Amin <email@hidden>)
 >Re: Right place to unobserve notifications in a document (From: "Michael Ash" <email@hidden>)
 >Re: Right place to unobserve notifications in a document (From: Negm-Awad Amin <email@hidden>)
 >Re: Right place to unobserve notifications in a document (From: Andy Lee <email@hidden>)
 >Re: Right place to unobserve notifications in a document (From: Negm-Awad Amin <email@hidden>)
 >Re: Right place to unobserve notifications in a document (From: Andy Lee <email@hidden>)
 >Re: Right place to unobserve notifications in a document (From: Negm-Awad Amin <email@hidden>)
 >Re: Right place to unobserve notifications in a document (From: "Joan Lluch (casa)" <email@hidden>)
 >Re: Right place to unobserve notifications in a document (From: Negm-Awad Amin <email@hidden>)

  • Prev by Date: NSView confusion
  • Next by Date: Re: NSView confusion
  • Previous by thread: Re: Right place to unobserve notifications in a document
  • Next by thread: Re: Right place to unobserve notifications in a document
  • Index(es):
    • Date
    • Thread