• 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: container retain/release problem
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: container retain/release problem


  • Subject: Re: container retain/release problem
  • From: email@hidden
  • Date: Thu, 10 Feb 2005 14:36:13 -0800

On Feb 10, 2005, at 2:25 PM, Paul Forgey wrote:
I've got an NSDictionary which I've built as per the quoted code below.
dict will autorelease, however I've got an NSArray element in there
which I've retained. So therefore, it should stick around, shouldn't
it? Problem is after the autorelease pool gets run, my instance
variable 'updates' has either been released or completely trashed.
Copying the array doesn't make things act any differently. What
exactly am I doing wrong?


If you have -retain'd the array that is contained within the dictionary then, yes, that array will continue to exist after the dictionary has been deallocated (-release'd completely -- never invoke -dealloc directly). If it isn't, then you are either over -release'ing it or you never -retain'd it in the first place.

More likely than not this ...

![updates isKindOfClass:[NSMutableArray
class]]

... is not doing what you expected it to do. There isn't a way to test an array for mutability; you have to know that it is mutable based upon your usage patterns (or call -mutableCopy to guarantee mutability). Try testing to see if it is of kind NSArray.


b.bum


_______________________________________________ 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
  • Follow-Ups:
    • Re: container retain/release problem
      • From: Paul Forgey <email@hidden>
References: 
 >RE: container retain/release problem (From: "Jonathan E. Jackel" <email@hidden>)
 >Re: container retain/release problem (From: Paul Forgey <email@hidden>)

  • Prev by Date: NSDocumentController redisplay NSPanel
  • Next by Date: Re: Creating the illusion of a full featured window
  • Previous by thread: Re: container retain/release problem
  • Next by thread: Re: container retain/release problem
  • Index(es):
    • Date
    • Thread