• 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
Crasher in MenuSelect
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Crasher in MenuSelect


  • Subject: Crasher in MenuSelect
  • From: Shaun Wexler <email@hidden>
  • Date: Tue, 28 Oct 2003 12:21:44 -0800

I think I may have found a bug within the menu system.

My app dynamically adds and/or removes items from a menu in the main menu, triggered by main thread notifications. While the user is tracking the main menu, the main thread's run loop is in NSEventTrackingRunLoopMode. A secondary thread can post a main thread notification (NSObject perform...), which is apparently being received in that mode, rather than in NSDefaultRunLoopMode, which allows the menu to be changed while still being displayed/tracked.

The app dies with this backtrace:

Thread 0 Crashed:
#0 0x901911c4 in CFRetain (CFRetain + 32)
#1 0x927e75cc in HIStandardMenuView::FetchItemCache(unsigned short) (HIStandardMenuView::FetchItemCache(unsigned short) + 112)
#2 0x92801bf0 in HIStandardMenuView::FindItem(float) (HIStandardMenuView::FindItem(float) + 112)
#3 0x9283e020 in HIStandardMenuView::GetPartHitSelf(CGPoint const&) (HIStandardMenuView::GetPartHitSelf(CGPoint const&) + 56)
#4 0x9283820c in HIView::IsHitByPointSelf(CGPoint const&, short*) (HIView::IsHitByPointSelf(CGPoint const&, short*) + 36)
#5 0x927d52f4 in HIView::EventHandler(OpaqueEventHandlerCallRef*, OpaqueEventRef*, void*) (HIView::EventHandler(OpaqueEventHandlerCallRef*, OpaqueEventRef*, void*) + 4584)
#6 0x927d1f94 in DispatchEventToHandlers (DispatchEventToHandlers + 336)
#7 0x927d2208 in SendEventToEventTargetInternal (SendEventToEventTargetInternal + 372)
#8 0x927d6600 in SendEventToEventTargetWithOptions (SendEventToEventTargetWithOptions + 40)
#9 0x927f9174 in SendControlDefHitTest(HIView*, CGPoint const&, short*) (SendControlDefHitTest(HIView*, CGPoint const&, short*) + 136)
#10 0x92833948 in HIView::GetRawPartHit(CGPoint const&) (HIView::GetRawPartHit(CGPoint const&) + 76)
#11 0x9282965c in HIView::GetPartHit(CGPoint const&) (HIView::GetPartHit(CGPoint const&) + 24)
#12 0x9284742c in HIViewGetPartHit (HIViewGetPartHit + 72)
#13 0x9280e6dc in MenuData::HitTestView(Point) (MenuData::HitTestView(Point) + 220)
#14 0x9280faa4 in ChooseItem(MenuSelectData*, unsigned char, Rect const*) (ChooseItem(MenuSelectData*, unsigned char, Rect const*) + 164)
#15 0x928180fc in TrackMenuCommon(MenuSelectData&, unsigned char*) (TrackMenuCommon(MenuSelectData&, unsigned char*) + 604)
#16 0x9285d578 in MenuSelectCore(Point, double, unsigned long, OpaqueMenuRef**, unsigned short*) (MenuSelectCore(Point, double, unsigned long, OpaqueMenuRef**, unsigned short*) + 176)
#17 0x92883974 in MenuSelect (MenuSelect + 96)
#18 0x92e2ecdc in _NSHandleCarbonMenuEvent (_NSHandleCarbonMenuEvent + 168)
#19 0x92dd2dd0 in _DPSNextEvent (_DPSNextEvent + 1232)
#20 0x92de93fc in -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] (-[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 116)
#21 0x92dfd730 in -[NSApplication run] (-[NSApplication run] + 540)
#22 0x3f00a434 in -[SKWApplication run] (SKWApplication.m:147)
#23 0x000081f0 in main (main.m:30)
#24 0x00007db8 in _start (crt.c:267)
#25 0x00007c2c in start (start + 48)

Before the app crashes, the menu gets some weird highlighting effects.

I suppose I could change the posting of the add/remove notifications to be dispatched only in NSDefaultRunLoopMode, but that seems hackish. I originally expected that the menu would be updated dynamically during tracking, when items are added or removed, similar to using alternate items in Panther, etc. I also expected that modifying the menus only on the main thread would suffice. Where should I go with this?
--
Shaun Wexler
MacFOH
http://www.macfoh.com
_______________________________________________
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.
  • Prev by Date: Re: How to switch language (nib)
  • Next by Date: Re: How to switch language (nib)
  • Previous by thread: game programming (was Re: OSX Programmer Needed $400)
  • Next by thread: Shell Script Build Phases - wait until I'm finished!
  • Index(es):
    • Date
    • Thread