• 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
dynamic menu and validateMenuItem crash
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

dynamic menu and validateMenuItem crash


  • Subject: dynamic menu and validateMenuItem crash
  • From: Christopher Corbell <email@hidden>
  • Date: Thu, 12 Jun 2003 18:03:11 -0700

I have a submenu off a main menu item which has changing contents
based on things like selections in an NSTableView, current key-window
and current first responder. I'm seeing a crash during update of this
menu and I'm hoping someone can suggest a workaround.

The first menu item of this submenu never changes - it may be enabled
or disabled but it is always present. So my approach (a parallel approach
worked in PowerPlant) is to use validateMenuItem to populate the rest of
this menu. When the unchanging first item is validated, I add, remove, or
change the other items in the menu appropriately. The first menu item is
identified by its selector; the other (dynamically added) items use a
different selector, so their validation is automatic (always enabled if
the selector is in the responder chain).

The crash seems to come whenever I remove items from the submenu
in this validation method. Apparently (this is a guess) validateMenuItem is
a bad place to remove sibling items from a menu. I tried turning on
remove-notification for the menu hoping this would fix it, but the crash
still occurs. I also confirmed that it has nothing to do in particular with
the other items or their selectors - if I just add a separator item, and then
remove it in a later validate call, the app crashes.

Does anyone know of a sure-fire workaround for this problem?
Also, is this considered proper behavior (& if so shouldn't the volatility
be mentioned in validateMenuItem documentation), or is it a bug?

Thanks for any help,
Christopher
_______________________________________________
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.

  • Follow-Ups:
    • Re: dynamic menu and validateMenuItem crash
      • From: Christopher Corbell <email@hidden>
  • Prev by Date: Re: WWDC tools wishlist (was Re: troubling article)
  • Next by Date: Re: Keywords - was Re: C question for you old guys ;-)
  • Previous by thread: Re: Tabs and InterfaceBuilder
  • Next by thread: Re: dynamic menu and validateMenuItem crash
  • Index(es):
    • Date
    • Thread