Re: Analyzer Messages
Re: Analyzer Messages
- Subject: Re: Analyzer Messages
- From: David Duncan <email@hidden>
- Date: Thu, 11 Aug 2011 13:16:23 -0700
Title: Analyzer Messages
On Aug 11, 2011, at 1:00 PM, Gordon Apple wrote:
I’m getting a lot of this. Is this just an issue with the analyzer, or am I missing something?
The analyzer doesn't do inter-procedural analysis, so it can't see this particular situation. That said, I would still consider it a dangerous pattern because... self.captureManager = [[AVCamCaptureManager alloc] init];
This uses the only owning reference you have to this object anonymously, preventing you from releasing it...
[self.captureManager release];
… while this is releasing an object that you do not own (since you don't own the return value of an accessor). Basically the pattern you are using is not considered safe. Especially consider if you decided that you needed to change a property like this to be copy instead of retain – suddenly your release doesn't balance the alloc anymore.
In general when I've seen this pattern in other source bases, it is lead to a number of subtle issues and often to workarounds like [self.foo retain] that are should not be necessary. As such, I would recommend abolishing this pattern from your code base.
|
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden