Hi all,

I've obviously not got the right mental model for something and I'm wondering why. It should be fairly obvious that this is quite early on in my Cocoa Career.

I've got an outline view that has a data source. The data source has routines that look like this:

-(id) outlineView:(NSOutlineView *) aView child:(NSInteger) anIndex ofItem:(id) anItem {
        id aDataItem = [someArray objectAtIndex:anIndex];
return [NSDictionary dictionaryWithObjectsAndKeys:aDataItem, @"DataItem", extraInfo, @"ExtraInfo"];
}

-(id) outlineView:(NSOutlineView *) aView objectValueForTableColumn: (NSTableColumn *) aColumn byItem:(id) anItem {
        id dataItem  = [anItem objectForKey:@"DataItem"];
        id extraInfo = [anItem objectForKey:@"ExtraInfo"];

        .....
}

This works fine the first time the view is populated, but when it's refreshed it just calls the second method with the pointers to the dictionaries I return first time round. Trouble is they've been autoreleased by now.

I know how to fix this, but I'm looking to understand.

Why, if the outline view is holding pointers to the objects I return from "outlineView:child:ofItem:", doesn't it retain them?
Why was I wrong to assume that an autoreleased object was sufficient?
Would the pointers it holds be strong or weak in a GC program?

Thanks

Paul
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to