• 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
NSMenuItemCell setMenuItem does not retain?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSMenuItemCell setMenuItem does not retain?


  • Subject: NSMenuItemCell setMenuItem does not retain?
  • From: Steve Mills <email@hidden>
  • Date: Fri, 02 Aug 2013 08:01:03 -0500

Is setMenuItem supposed to retain the item? We have some code written quite a while ago that looks like:

- (id)copyMixedCellForTableColumn:(NSTableColumn*)tableColumn withText:(FinUString)text
{
	NSMenuItem*	menuItem = [[[NSMenuItem alloc] initWithTitle:[NSString stringWithFinUString:text] action:nil keyEquivalent:@""] autorelease];
	id		cell = [[tableColumn dataCell] copy];

	[cell setUsesItemFromMenu:NO];
	[cell setMenuItem:menuItem];

	return cell;
}

Under 10.7, we get a zombie overreleased crash when the autorelease pool goes to finally release this menu item. If we take out the autorelease, no crash. 10.8 seems to run OK and doesn't report a zombie, but I also can't see it leaking if I remove the autorelease. I'm not sure why. Maybe Instruments wasn't behaving. The docs for setUsesItemFromMenu shows a sample where the item is released.

--
Steve Mills
office: 952-818-3871
home: 952-401-6255
cell: 612-803-6157



_______________________________________________

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


  • Follow-Ups:
    • Re: NSMenuItemCell setMenuItem does not retain?
      • From: Uli Kusterer <email@hidden>
  • Prev by Date: Re: Exiting non-POSIX threads?
  • Next by Date: Re: NSMenuItemCell setMenuItem does not retain?
  • Previous by thread: Re: IOS force hidden tab to adjust subviews after rotation
  • Next by thread: Re: NSMenuItemCell setMenuItem does not retain?
  • Index(es):
    • Date
    • Thread