• 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
menu madness with retain count
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

menu madness with retain count


  • Subject: menu madness with retain count
  • From: Bill Appleton <email@hidden>
  • Date: Tue, 27 Apr 2010 06:46:11 -0700

hi all,

i like to create some menus, set them as the main menu bar, then maybe
delete them, and create some more menus, use them, etc.

but i can't find any way to do this with cocoa

here is the problem

when you add a submenu (setSubMenu:forItem) the retain count on the submenu
goes up by one

but when you delete that item, or set its submenu to nil, the retain count
does not change

if you ever delete a menu that has a submenu you will get a crash, but there
is no way to unassociate the menu and the submenu

another problem: when you set the main menu bar  [NSApp setMainMenu:themenu]
the retain count on themenu goes up by a lot, i can't predict it, but maybe
4 or 5

if you set the main menu bar to nil the retain count does not change on the
original main menu

so given all this, i can't find a way to create and delete menus without
crashes or memory leaks

am i doing something wrong?



thanks

bill appleton
_______________________________________________

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: menu madness with retain count
      • From: Graham Cox <email@hidden>
    • Re: menu madness with retain count
      • From: Keary Suska <email@hidden>
  • Prev by Date: Re: NSApplicationMain question
  • Next by Date: Re: Make About window respond to ⌘W in UI-less application
  • Previous by thread: Re: NewMovieFromDataRef crashes when QT movie URL is not found
  • Next by thread: Re: menu madness with retain count
  • Index(es):
    • Date
    • Thread