RE: retain variables between classes
RE: retain variables between classes
- Subject: RE: retain variables between classes
- From: "Jonathan E. Jackel" <email@hidden>
- Date: Tue, 16 Dec 2003 14:44:47 -0500
Jay Rimalrick wrote:
>
I have two classes MainClass and AClass
>
>
AClass has a method (with data item array)
>
-(void)setInfo: (NSMutableArray *)inArray
>
{
>
[array release];
>
[inArray retain];
>
array = inArray; // also tried array = [inArray mutableCopy]
>
}
>
This is wrong. You should retain inArray before your release array. Why?
They might both be pointing to the same object. When you release it, you
may be releasing inArray, possibly causing it to disappear. This could be
the source of your problem.
Jonathan
_______________________________________________
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.