Hi all,
Now I’m making a Mac stand-alone app using juce 2.0.38.
Then I found a menu bar issue on mac as below.
Use native menu bar by MenuBarModel::setMacMainMenu(), and some menu items have shortcut keys.
Open popup menu of the menu bar by mouse click.
While showing the popup menu, press down any shortcut key (like command+s) and invoke menu item action.
Show modal dialog using FileChooser or AlertWindow in the action.
After closing the modal dialog, application will crash.
I’m checking source code around MainMenu, but now I cannot find good countermeasure…
Can somebody help about this?
Best regards,
Tomoyuki Kato
Korg Inc.
jules
March 19, 2013, 8:42am
2
Hmm, I tried this in the introjucer, by right-clicking on some source code to get a popup menu, then hitting cmd-O, but it correctly ignored the shortcut.
Where exactly did it crash?
Hi jules,
This crash is occurred by menu bar that is located on top of the screen. It is not on right-click popup menu.
I also tried this in the introjucer, and it occurred.
Detailed procedure is as below:
I used zip version of juce, and built it on Xcode 4.2 ( OS X 10.6.8 )
(downloaded from https://github.com/julianstorer/JUCE/archive/master.zip )
Launch the introjucer.
Click “File” menu on menu bar located on top of the screen. (File popup menu will be shown)
Then press down command+O key. Don’t use mouse here. (“Open File” dialog will be shown)
Click “Cancel” button and close the dialog.
Then the introjucer often crash. (Sometimes it did not happened)
Then, got following log.
Debugger stopped at L510 of “juce_mac_MainMenu.mm” when I tried debug version. (peer->redirectKeyDown (e)
Does this help you?
Thread 0 Crashed: Dispatch queue: com.apple.main-thread
0 libobjc.A.dylib 0x921ebf87 objc_msgSend + 23
1 …materialsoftware.introjucer 0x00274d00 juce::NSViewComponentPeer::redirectKeyDown(NSEvent*) + 80
2 …materialsoftware.introjucer 0x00274992 juce::JuceMainMenuHandler::JuceMenuCallbackClass::menuItemInvoked(objc_object*, objc_selector*, NSMenuItem*) + 466
3 com.apple.AppKit 0x9a271a26 -[NSApplication sendAction:to:from:] + 112
4 com.apple.AppKit 0x9a2718d9 -[NSMenuItem _corePerformAction] + 435
5 com.apple.AppKit 0x9a2715ca -[NSCarbonMenuImpl performActionWithHighlightingForItemAtIndex:] + 174
6 com.apple.AppKit 0x9a2714b6 -[NSMenu performActionForItemAtIndex:] + 65
7 com.apple.AppKit 0x9a271469 -[NSMenu _internalPerformActionForItemAtIndex:] + 50
8 com.apple.AppKit 0x9a2713cf -[NSMenuItem _internalPerformActionThroughMenuIfPossible] + 97
9 com.apple.AppKit 0x9a271313 -[NSCarbonMenuImpl _carbonCommandProcessEvent:handlerCallRef:] + 336
10 com.apple.AppKit 0x9a265a55 NSSLMMenuEventHandler + 404
11 com.apple.HIToolbox 0x972f7c0f DispatchEventToHandlers(EventTargetRec*, OpaqueEventRef*, HandlerCallRec*) + 1567
12 com.apple.HIToolbox 0x972f6ed6 SendEventToEventTargetInternal(OpaqueEventRef*, OpaqueEventTargetRef*, HandlerCallRec*) + 411
13 com.apple.HIToolbox 0x97319773 SendEventToEventTarget + 52
14 com.apple.HIToolbox 0x97345dc7 SendHICommandEvent(unsigned long, HICommand const*, unsigned long, unsigned long, unsigned char, void const*, OpaqueEventTargetRef*, OpaqueEventTargetRef*, OpaqueEventRef**) + 448
15 com.apple.HIToolbox 0x9736ab38 SendMenuCommandWithContextAndModifiers + 66
16 com.apple.HIToolbox 0x9736aaef SendMenuItemSelectedEvent + 121
17 com.apple.HIToolbox 0x9736a9f7 FinishMenuSelection(SelectionData*, MenuResult*, MenuResult*) + 152
18 com.apple.HIToolbox 0x9733a0ba MenuSelectCore(MenuData*, Point, double, unsigned long, OpaqueMenuRef**, unsigned short*) + 454
19 com.apple.HIToolbox 0x97339815 _HandleMenuSelection2 + 465
20 com.apple.HIToolbox 0x97339633 _HandleMenuSelection + 53
21 com.apple.AppKit 0x9a25ef96 _NSHandleCarbonMenuEvent + 285
22 com.apple.AppKit 0x9a233b46 _DPSNextEvent + 2304
23 com.apple.AppKit 0x9a232dd6 -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 156
24 com.apple.AppKit 0x9a1f51f3 -[NSApplication run] + 821
25 …materialsoftware.introjucer 0x0012a1ed juce::MessageManager::runDispatchLoop() + 93
26 …materialsoftware.introjucer 0x0025c601 juce::JUCEApplication::main() + 161
27 …materialsoftware.introjucer 0x0025c6d9 juce::JUCEApplication::main(int, char const**) + 57
28 …materialsoftware.introjucer 0x00001e25 start + 53
jules
March 19, 2013, 1:31pm
4
Ok, thanks - I’ve sorted that out now, let me know if you still have problems!
I updated to the new source code, and checked fixing this.
Thank you for the quick response and fixing!