The static analyzer in Xcode 6.3 (6D554n) is generating what seems to be a
bogus warning saying "Incorrect decrement of the reference count of an object
that is not owned at this point by the caller”. I’ve never seen this specific
message before so I’m guessing it’s new. It occurs in a -dealloc method when
releasing an instance variable that has a synthesized getter; if I replace the
getter with a hand-written one, the warning goes away.
Below is a reduction. The class Foo triggers the warning, the class Bar does
not. The only difference between the classes is that Foo has a synthesized
getter while Bar’s is explicit.
I’m 99% sure this is a bug, and I’ll file a bug report, but there’s always the
chance that I’m missing something…
—Jens
@interface Foo : NSObject
@property (readonly) NSError* error;
@end
@implementation Foo
{
NSError* _error;
}
@synthesize error=_error; // Note: synthesized property
- (void) dealloc {
[_error release]; // WARNING: "Incorrect decrement of the reference
count..."
[super dealloc];
}
@end
@interface Bar : NSObject
@property (readonly) NSError* error;
@end
@implementation Bar
{
NSError* _error;
}
- (NSError*) error {return _error;} // Note: Explicit getter method
- (void) dealloc {
[_error release]; // No warning!
[super dealloc];
}
@end
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list ([email protected])
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/xcode-users/archive%40mail-archive.com
This email sent to [email protected]