RE: Outlets / IBOutlet declarations (was Re: Interface Builder &Wiring Objects)
RE: Outlets / IBOutlet declarations (was Re: Interface Builder &Wiring Objects)
- Subject: RE: Outlets / IBOutlet declarations (was Re: Interface Builder &Wiring Objects)
- From: "Jeff Laing" <email@hidden>
- Date: Wed, 19 Nov 2008 14:57:10 -0700
- Thread-topic: Outlets / IBOutlet declarations (was Re: Interface Builder &Wiring Objects)
> But if your dealloc is like this...
>
> - (void)dealloc
> {
> self.thisProp = nil;
> self.thatProp = nil;
> ...
> }
>
> then you'll be calling the accessors and the right thing will happen
> (i.e. release if necessary). This is what I currently do for all dev
> work (iPhone or Mac OS X). In fact, I use accessors everywhere and
> never do direct ivar access.
My understanding (and I'm a noob in this) is that "best practices"
recommend that you shouldn't start sending additional messages to an
object from inside its dealloc.
Those property accesses are just candy-coated calls to setThisProp:, etc
which violates the 'don't send message to yourself' recommendation.
Anyone want to clarify if it is/isn't safe to do this? Certainly most
of the samples I've seen go out of their way to release instance
variables rather than nil properties, in their dealloc's
(This is the one thing I hate the *most* about properties - they really
feel glued on, at this point, rather than being a language feature that
the "whole compiler" knows about)
_______________________________________________
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