Re: Appropriate dealloc and finalize actions
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