Re: Unarchiver problems!
Re: Unarchiver problems!
- Subject: Re: Unarchiver problems!
- From: Ricky Sharp <email@hidden>
- Date: Sat, 26 Mar 2005 07:23:02 -0600
On Mar 25, 2005, at 11:41 PM, glenn andreas wrote:
On Mar 25, 2005, at 11:29 PM, Tom Birch wrote:
This is following on from my "Bindings problems" thread, I have
reduced the problem down to something with NSUnarchiver, or,
something. Here is a gdb trace that should give you a fair idea of
what is going on:
http://tbir905.web.cse.unsw.edu.au/gdbsession.txt
38 - (id)initWithCoder:(NSCoder *)coder
39 {
40 if(self = [super init])
41 {
42 dict = [coder decodeObject];
43 }
44 return self;
Line 42 should be dict = [[coder decodeObject] retain];
You could also make use of accessors:
[self setDict:[coder decodeObject]];
where setDict: will do the right thing with memory management.
This is what I do for all my objects for init, initWithCoder,
encodeWithCoder, dealloc, etc. In fact, the only code that ever
directly accesses ivars for reading/writing is from the accessor
implementations.
___________________________________________________________
Ricky A. Sharp mailto:email@hidden
Instant Interactive(tm) http://www.instantinteractive.com
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden