Found It - Problem with Outline View and Manual Memory Management
Found It - Problem with Outline View and Manual Memory Management
- Subject: Found It - Problem with Outline View and Manual Memory Management
- From: Dave <email@hidden>
- Date: Wed, 27 May 2015 15:56:20 +0100
Hi,
I’ve Found it, please see line marked below.
In I change this to:
myCell = (ImageAndTextCell*) [cell copy]; //*******************************************************************************************************************
It doesn’t work, which is a bit of a mystery? Because of this, I think there is something wrong somewhere else which copying and releasing here is working-around the problem, rather than solving at source?
I assume that in the Source Project, under ARC, the value was retained auto-magically?
Thanks Again,
Dave
- (void)outlineView:(NSOutlineView *)olv willDisplayCell:(NSCell*)cell forTableColumn:(NSTableColumn *)tableColumn item:(id) item
{
NSImage* iconImage;
NSString* urlStr;
ImageAndTextCell* myCell;
ChildNode* myChildNode;
if ([[tableColumn identifier] isEqualToString:COLUMNID_NAME] == NO)
return;
if ([cell isKindOfClass:[ImageAndTextCell class]] == NO)
return;
myChildNode = [item representedObject];
if (myChildNode == nil)
return;
if ([myChildNode class] != [ChildNode class])
return;
myCell = (ImageAndTextCell*) [cell copy]; //*******************************************************************************************************************
myCell.pTextCellImage = nil;
iconImage = nil;
if (myChildNode.isLeaf == YES)
{
urlStr = myChildNode.urlString;
if (urlStr != nil)
{
if ([myChildNode.urlString hasPrefix:HTTP_PREFIX] == YES)
{
myChildNode.nodeIcon = self.pURLImage;
}
else
{
iconImage = [[NSWorkspace sharedWorkspace] iconForFile:urlStr];
myChildNode.nodeIcon = iconImage;
}
}
}
//**
//** Check if it's a special folder (PLACES or BOOKMARKS), we don't want it to have an icon
//**
else
{
if ([self isSpecialGroup:myChildNode] == YES)
{
myChildNode.nodeIcon = nil;
}
else
{
myChildNode.nodeIcon = self.pFolderImage;
}
}
[myChildNode.nodeIcon setSize:NSMakeSize(kIconImageSize,kIconImageSize)];
iconImage = myChildNode.nodeIcon;
myCell.pTextCellImage = iconImage;
[myCell release];
}
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden