• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Bogus static-analyzer warning "Incorrect decrement of the reference count of an object..."
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Bogus static-analyzer warning "Incorrect decrement of the reference count of an object..."


  • Subject: Bogus static-analyzer warning "Incorrect decrement of the reference count of an object..."
  • From: Jens Alfke <email@hidden>
  • Date: Fri, 27 Mar 2015 16:33:32 -0700

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@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Prev by Date: Re: OS X Storyboard & Cross-Scene iBOutlet?
  • Next by Date: Search field in Document window not very editable
  • Previous by thread: Re: OS X Storyboard & Cross-Scene iBOutlet?
  • Next by thread: Search field in Document window not very editable
  • Index(es):
    • Date
    • Thread