On Feb 20, 2009, at 1:05 AM, Alexander Spohr wrote:


Am 20.02.2009 um 04:18 schrieb mmalc Crawford:


On Feb 19, 2009, at 12:34 PM, mmalc Crawford wrote:

See also updated: <http://developer.apple.com/documentation/Cocoa/Conceptual/MemoryMgmt/Articles/mmNibObjects.html >


The Doc states:
You should therefore also set outlet variables to nil in dealloc:

- (void)dealloc {
        // release outlets and set outlet variables to nil
        [anOutlet release], anOutlet = nil;
        [super dealloc];
}

why not just use

        [self setAnOutlet = nil];
or
        self.anOutlet = nil;

Any danger in this? (except a bad implementation of setAnOutlet:)


Any of the standard arguments about not calling setters in dealloc and init would apply. For example, if you were subclassed, and your subclass had an override of one of your setters, and you called it from dealloc you'd be calling one of their methods after they'd called [super dealloc]. Or, you might later implement side-effects for one of your setters not thinking about the called-from-dealloc-case and introduce a subtle bug into your own code.

Jon Hess


        atze

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/jhess%40apple.com

This email sent to jh...@apple.com

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to