Re: releasing NSKeyedUnarchiver causes crash
Re: releasing NSKeyedUnarchiver causes crash
- Subject: Re: releasing NSKeyedUnarchiver causes crash
- From: Markus Spoettl <email@hidden>
- Date: Sun, 18 May 2008 10:04:47 -0700
On May 18, 2008, at 5:25 AM, Klaus Backert wrote:
- (BOOL)readFromData:(NSData *)data ofType:(NSString *)typeName
error:(NSError **)outError
{
*outError = nil;
NSKeyedUnarchiver *archiver;
archiver = [[NSKeyedUnarchiver alloc] initForReadingWithData:
data];
// release current data
[tracks release];
tracks = [archiver decodeObjectForKey: @"myobject"];
[tracks retain];
may be because this is missing:
[archiver finishDecoding];
That wasn't it but thanks for helping.
The real reason was that I forgot to retain the objects decoded in
tracks:initWithCoder: after decoding, so instead of
timeStamp = [[decoder decodeObjectForKey:@"timeStamp"] retain];
I had
timeStamp = [decoder decodeObjectForKey:@"timeStamp"];
and apparently the NSKeyedUnarchiver was the only think keeping that
data alive.
Well, I apologize for wasting your time.
Regards
Markus
--
__________________________________________
Markus Spoettl
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden