Re: Autorelease problem with NSKeyedUnarchive
Re: Autorelease problem with NSKeyedUnarchive
- Subject: Re: Autorelease problem with NSKeyedUnarchive
- From: Scott Anguish <email@hidden>
- Date: Thu, 21 Aug 2003 04:14:25 -0400
This is because the returned result is autoreleased, and so unless you
retain it, you stand the chance of losing it. You're releasing it when
you didn't retain it, so when the autorelease pool tries to release it
again, the world collapses in upon itself and all life as we know it
ceases to exist.
It fits the category of "you didn't explicitly alloc/init it, so you
must retain"...
On Thursday, August 21, 2003, at 3:31 AM, Michael S|ssner wrote:
I have written a small test tool archiving and unarchiving a customized
subclass of NSObject.
Each time
vData = [NSKeyedUnarchiver
unarchiveObjectWithFile:@"/tmp/jwtestarchive"];
...
[vData release];
It seems to workout fine but when the Autorelease pool is finally
released,
the tool crashes within the release method of the autolease class.
If I retain the vData object, then I do not run into a memory
BAD_ACCESS. I
have studied the release documents and could not find any hint.
Any help?
Michael
_______________________________________________
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.
_______________________________________________
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.