Re: XCode not releasing nsstring
Re: XCode not releasing nsstring
- Subject: Re: XCode not releasing nsstring
- From: James Spencer <email@hidden>
- Date: Tue, 11 Nov 2003 21:12:06 -0600
On Nov 11, 2003, at 7:20 PM, Justin Lundy wrote:
[releaseTest release];
if (releaseTest != nil) NSLog(@"C: releaseTest NOT nil.");
if (releaseTest == nil) NSLog(@"C: releaseTest nil.");
and guess what the log said?
A: releaseTest nil.
B: releaseTest NOT nil.
C: releaseTest NOT nil.
Call me crazy, but shouldn't the last one say "C: releaseTest nil."?
Your test doesn't test whether the object has been released; it tests
whether the variable release test is nil. It's not; it still contains
the pointer to the old (no longer valid) NSString. Try sending a
message to the released object and you should get an error back.
James P. Spencer
Rochester, MN
email@hidden
"Badges?? We don't need no stinkin badges!"
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.