• 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: Appropriate dealloc and finalize actions
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Appropriate dealloc and finalize actions


  • Subject: Re: Appropriate dealloc and finalize actions
  • From: Jens Alfke <email@hidden>
  • Date: Sun, 11 Oct 2009 22:05:07 -0700


On Oct 11, 2009, at 4:11 PM, Greg Guerin wrote:

Why would you do this? You're making one object responsible for the internals of another object. This is a bad idea. It breaks the individual encapsulation of each object.

But there are times you need to do this. One example is in some teardown situations with NSWindowControllers — I've sometimes had to clear the window's delegate property to avoid the window trying to message the controller after it's been torn down.


It's not so much making an object responsible for another object's internals, as simply managing a relation from that other object. In other words, I'm the one who told the window to point its delegate property to me, so it's OK for me to tell it to point it to nil when I go away.

—Jens_______________________________________________

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: 
 >Re: Appropriate dealloc and finalize actions (From: Greg Guerin <email@hidden>)

  • Prev by Date: Re: Appropriate dealloc and finalize actions
  • Next by Date: Re: NSCollectionView delegate methods aren't called
  • Previous by thread: Re: Appropriate dealloc and finalize actions
  • Next by thread: Re: Appropriate dealloc and finalize actions
  • Index(es):
    • Date
    • Thread