Re: Archive crash
Re: Archive crash
- Subject: Re: Archive crash
- From: Brock Brandenberg <email@hidden>
- Date: Tue, 06 Aug 2002 11:36:59 -0500
Hi Brad.
>
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: -
You need to retain the decoded objects as well. Retaining the object
returned from the NSUnarchiver is not sufficient enough. If you don't retain
the decoded object, it is "owned" by the decoder, which means it may be
relased at some time not under your control. Try this.
- (id)initWithCoder:(NSCoder *)coder
{
if (self = [super init])
{
theStroke = [[coder decodeObject] retain];
}
return self;
}
Remember to release it when you're done with it, just like you would do if
you alloc'ed it.
Brock Brandenberg
----- industrial design @ www.bergdesign.com ------
_______________________________________________
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.