Skip navigation.
 
mlRe: releasing NSKeyedUnarchiver causes crash
FROM : Markus Spoettl
DATE : Sun May 18 19:04:47 2008

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
--

Related mailsAuthorDate
mlreleasing NSKeyedUnarchiver causes crash Markus Spoettl May 18, 09:51
mlreleasing NSKeyedUnarchiver causes crash Klaus Backert May 18, 14:25
mlRe: releasing NSKeyedUnarchiver causes crash Markus Spoettl May 18, 19:04
mlRe: releasing NSKeyedUnarchiver causes crash Jonathan Dann May 18, 22:53
mlRe: releasing NSKeyedUnarchiver causes crash Markus Spoettl May 19, 03:54