Archive crash
Archive crash
- Subject: Archive crash
- From: "Smith, Bradley" <email@hidden>
- Date: Tue, 6 Aug 2002 15:35:05 +0100
Hi everyone,
Firstly apologies to any to whom I've accidentally sent a personal message
when it was meant to go to the list (only just noticed that reply went to
the poster - different from the Newton list!).
Now, I have a multi-doc Cocoa app. At the moment is just has an
NSMutableArray of NSBezierPaths. The problem I have is that when I load a
document I get one of those SIGNAL crashes and the app shuts. Here's a few
code snippets from the areas that I think (with my limited knowlege) may
have gone wrong: -
// My Document class
- (NSData *)dataRepresentationOfType:(NSString *)aType
{
// strokes is a mutable array of pointers to a a class called
LayoutStroke
return [NSArchiver archivedDataWithRootObject: strokes];
}
- (BOOL)loadDataRepresentation:(NSData *)data ofType:(NSString *)docType
{
[strokes release];
strokes = [[NSUnarchiver unarchiveObjectWith
Data:data] retain];
[self refreshTheView];
return YES;
}
// My LayoutStroke class header and impl
// HEader
@interface LayoutStroke : NSObject<NSCoding>
{
NSBezierPath *theStroke;
}
- (id)initWithStart:(NSPoint) point;
- (void)draw;
- (void)addWayPoint:(NSPoint) point;
// Impl
- (id)initWithCoder:(NSCoder *)coder
{
if (self = [super init])
{
theStroke = [coder decodeObject];
}
return self;
}
- (void)encodeWithCoder:(NSCoder *)coder
{
[coder encodeObject: theStroke];
}
Now, I'll be amazed if anyone spots the problem just from this but maybe
there's some basic concept that I've got wrong?
best regards (fingers crossed!)
Brad
_______________________________________________
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.