Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
Re: NSString Retain Count of 2147483647
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSString Retain Count of 2147483647




Le 24 juin 09 à 18:05, Bill Bumgarner a écrit :

On Jun 24, 2009, at 11:03 AM, Jean-Daniel Dupas wrote:
And it should not be an issue as you should not use it after release (the Static Analyzer will warn you if you do something like that).

I'm not sure the static analyzer will catch/warn about:

id someObject = [[MyObject alloc] init];
[someArray addObject:someObject];
[someObject release];
[someObject doSomething;

As it might assume that someArray took ownership.  If it doesn't, it should.  

Actually it does not warn. But IMHO it should. What if 'someArray' is a subclass of NSArray that does not retain its content (a CFArray created using NULL callback for example) ? 

And even with a standard NSMutableArray, it does not warn if you do something like this but should too:

id someObject = [[MyObject alloc] init];
[someArray addObject:someObject];
[someArray removeObject:someObject];
[someObject release];
[someObject doSomething];


 _______________________________________________
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

References: 
 >NSString Retain Count of 2147483647 (From: Thomas Wetmore <email@hidden>)
 >Re: NSString Retain Count of 2147483647 (From: Gwynne Raskind <email@hidden>)
 >Re: NSString Retain Count of 2147483647 (From: Clark Cox <email@hidden>)
 >Re: NSString Retain Count of 2147483647 (From: Martin Redington <email@hidden>)
 >Re: NSString Retain Count of 2147483647 (From: Jean-Daniel Dupas <email@hidden>)
 >Re: NSString Retain Count of 2147483647 (From: Bill Bumgarner <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.