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

container retain/release problem


  • Subject: container retain/release problem
  • From: Paul Forgey <email@hidden>
  • Date: Wed, 9 Feb 2005 23:24:48 -0800

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?

-(void)connectionDidFinishLoading:(NSURLConnection *)conn
{
    NSMutableDictionary *dict;
    NSString *errorString;
    NSPropertyListFormat format;

dict = [NSPropertyListSerialization propertyListFromData:recvBuffer
mutabilityOption:NSPropertyListMutableContainersAndLeaves format:&format
errorDescription:&errorString];


    [connection release];
    connection = nil;

    [recvBuffer release];
    recvBuffer = nil;

if (dict != nil)
{
if (updates != nil)
[updates release];
updates = [dict objectForKey:@"Updates"];
if (updates != nil && ![updates isKindOfClass:[NSMutableArray class]])
updates = nil;
else
[updates retain];


        if (delegate != nil)
            [delegate dataSourceReloaded:self];
    }
    else
    if (delegate != nil)
    {
        [delegate dataSource:self didFail:errorString];
    }
}

_______________________________________________
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: "Jonathan E. Jackel" <email@hidden>
  • Prev by Date: Re: Binding NSArrayController to model array without NSTableView: Master-Detail interface
  • Next by Date: Re: Binding userdefaults update
  • Previous by thread: Re: NSTableView can't delete last column?
  • Next by thread: RE: container retain/release problem
  • Index(es):
    • Date
    • Thread