Re: Problem filing modified Sketch objects (Newbie)
Re: Problem filing modified Sketch objects (Newbie)
- Subject: Re: Problem filing modified Sketch objects (Newbie)
- From: "J. Norvell" <email@hidden>
- Date: Wed, 1 Jun 2005 17:16:51 -0700 (PDT)
Thanks Bob!
That nailed it.
Joel
--- Bob Ippolito <email@hidden> wrote:
> On May 31, 2005, at 11:53 PM, J. Norvell wrote:
>
> > I've modified Mike Ferris's Sketch example so that the
> > SKTGraphic class has an extra ivar, an NSMutableString.
> > When I save and open a Sketch document I can see in the
> > debugger that my instance variable has become "invalid"
> > but I can't figure out what I'm doing wrong.
>
> Your reference counting is not correct.
>
> > - (id)init {
> ... replace this:
> > [self setTheCellID:[[NSMutableString alloc]
> > initWithString:@"A01"]]; // ***
> ... with this:
> NSMutableString *cellID = [[NSMutableString alloc]
> initWithString:@"A01"];
> [self setTheCellID:cellID];
> [cellID release];
>
> > - (void)setCellID:(NSMutableString *)theCellID { // *** ADDED
> > Accessor method
> ... replace this:
> > _cellID = theCellID;
> ... with this:
> [self setTheCellID:theCellID];
>
> > - (void)setTheCellID:(NSMutableString *)theCellID { // *** ADDED
> > Accessor method
> ... replace this:
> > if (_cellID != theCellID) {
> > _cellID = theCellID;
> > }
> ... with this:
> [theCellID retain];
> [_cellID release];
> _cellID = theCellID;
>
> -bob
>
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.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