• 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: Jens Alfke <email@hidden>
  • Date: Mon, 16 Jun 2008 11:23:50 -0700


On 15 Jun '08, at 5:39 PM, James W. Walker wrote:

No, the controller does not keep a reference to the task. Why would it need to do that in order to "keep it alive"?

Because objects only exist if they have references (i.e. a refcount > 0), and it generally makes your code cleaner if those references "belong to" other objects, i.e. the typical retained-instance-variable pattern. While it's possible in a ref-counted environment to have an object that calls retain and release on itself to manage its own lifespan, it can be confusing to keep track of. It also has the distinct problem of not working with real garbage collection — if the garbage collector sees that nothing else in the app points to your object, it will dealloc it.


—Jens

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________

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: "Hamish Allan" <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: looking for a crc code
  • 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