On May 7, 2015, at 6:44 AM, Daniel Höpfl <[email protected]> wrote: > > I'd change the code as follows: > > // init > self.cycler = [[[GridCycler alloc] initWithGrid: self] autorelease]; > > // alternative init, if you want to bypass the autorelease pool: > > GridCycler *cycler = [[GridCycler alloc] initWithGrid: self]; > self.cycler = cycler; > [cycler release]; > // Don't use [self.cycler release], one day you might change the property to > copy. > > > // dealloc: > // nothing.
The dealloc is wrong here; that still has to release the property, either by setting it to nil or by releasing the ivar (not through a property access). With MRC, properties aren’t automatically released on dealloc. So, in dealloc, either: [_cycler release]; or: self.cycler = nil; Charles _______________________________________________ Cocoa-dev mailing list ([email protected]) 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [email protected]
