retain qualifier on property
retain qualifier on property
- Subject: retain qualifier on property
- From: Jonathan Taylor <email@hidden>
- Date: Wed, 08 Jun 2011 18:15:44 +0100
This is probably a very basic conceptual question but one I haven't been able to find a clear answer to. It concerns the "retain" qualifier on a class property. I can declare for example:
@property (nonatomic, readwrite, retain) id<FrameProtocol> latestFrame
The objects are retained and released correctly if I set this property to a new value, or to nil. However when the parent object is deallocated, no release is sent to the latestFrame object. I don't know if this is expected behaviour or not.
At the moment I ensure that the object is released by explicitly setting self.latestFrame to nil during the parent class's dealloc method. However naively it seems to me like the "expected" behaviour should be for self.latestFrame to be automatically released if non-nil when self is dealloced (though I would believe it if I was told there were good reasons not to do that, too!). Anyway, I just want to check that this is all behaving as expected, and that it does not indicate some sort of problem somewhere in my code that is preventing things from happening automatically as they should.
Thanks
Jonny_______________________________________________
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