memory leak with menu icon
memory leak with menu icon
- Subject: memory leak with menu icon
- From: Tavis <email@hidden>
- Date: Tue, 25 Nov 2003 10:19:58 -0800
Hi,
I can't solve this memory leak. I can't release it. I am adding an icon
to a menu like this (commented out code does not work either):
item = [[NSMenuItem alloc] initWithTitle:title
action:@selector(myAction:) keyEquivalent:@""];
image = [[NSWorkspace sharedWorkspace]
iconForFile:iconPath];
[image setSize:NSMakeSize(16.0,16.0)];
[item setImage:image];
[item setTarget:self];
[theMenu insertItem:item atIndex:4];
then later I clear the menu like this:
while(item=[enumerator nextObject]){
if([item action]==@selector(myAction:)){
[theMenu removeItem:item];
}
}
but the memory does not free up and next time I build the menu more
memory gets consumed
If i take out the [item setImage:image]; all is fine.
Any ideas?
_______________________________________________
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.