Re: NSImage allocation issues
Re: NSImage allocation issues
- Subject: Re: NSImage allocation issues
- From: Nicko van Someren <email@hidden>
- Date: Fri, 30 Apr 2004 15:03:15 +0100
On 30 Apr 2004, at 13:16, Clark Cox wrote:
On Apr 30, 2004, at 07:41, Jesus De Meyer wrote:
...
This is what I currently do:
NSMenuItem *mi = [[NSMenuItem alloc] initWithTitle:theItem action:nil
keyEquivalent:@""];
NSImage *icon = [[NSWorkspace sharedWorkspace] iconForFile:itemPath];
if ([[[NSUserDefaults standardUserDefaults] objectForKey:@"showIcons"]
intValue] && icon) {
[icon setSize:NSMakeSize(16, 16)];
[mi setImage:icon];
}
[menu addItem:mi];
Anybody know how I can fix this?
I don't see the problem. The image is retained by the menu item.
I think that the menu item is over-retained. It is created using alloc
and retained by the menu. I suspect tacking [mi release] after the
menu item is added to the menu might fix this.
Nicko
_______________________________________________
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.