• 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: How can an object know when another object has gone away?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How can an object know when another object has gone away?


  • Subject: Re: How can an object know when another object has gone away?
  • From: Christopher Nebel <email@hidden>
  • Date: Mon, 16 Jun 2008 14:14:47 -0700

On Jun 15, 2008, at 3:53 PM, James W. Walker wrote:

On Jun 15, 2008, at 3:25 PM, Andreas Monitzer wrote:

On Jun 16, 2008, at 00:20, James W. Walker wrote:

Is there a standard Cocoa design pattern or idiom to have an object find out when another object has been destroyed? In PowerPlant, I'd use LBroadcaster and LListener, with the listener listening for msg_BroadcasterDied.

What about using NSNotificationCenter?

Thanks, it looks like that would work. Somehow I was under the impression that notifications were, uh, broadcast more broadly than I wanted, but now I see that you can register to receive notifications only for a specific object.

If using the new Objective-C garbage collection is an option, you could also use a zeroing weak reference: see <http://developer.apple.com/documentation/Cocoa/Conceptual/GarbageCollection/Articles/gcDesignPatterns.html#//apple_ref/doc/uid/TP40006762-SW10 >



--Chris N. _______________________________________________

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: 
 >How can an object know when another object has gone away? (From: "James W. Walker" <email@hidden>)
 >Re: How can an object know when another object has gone away? (From: Andreas Monitzer <email@hidden>)
 >Re: How can an object know when another object has gone away? (From: "James W. Walker" <email@hidden>)

  • Prev by Date: Re: launching finder with optionschi
  • Next by Date: Re: How can an object know when another object has gone away?
  • Previous by thread: Re: How can an object know when another object has gone away?
  • Next by thread: Re: How can an object know when another object has gone away?
  • Index(es):
    • Date
    • Thread