• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
RE: retain variables between classes
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

References: 
 >retain variables between classes (From: "Jay Rimalrick" <email@hidden>)

  • Prev by Date: Re: retain variables between classes
  • Next by Date: Re: Changing the Locale for a single App?
  • Previous by thread: Re: retain variables between classes
  • Next by thread: Re: retain variables between classes
  • Index(es):
    • Date
    • Thread