Strange assert in Projucer


#1

I keep hitting an assert in juce_Component in grabKeyboardFocus() when trying to launch a file dialogue from the Projucer. I’m assuming this is something local to my machine but I’ve no idea what’s caused it. Here is the backtrace from lldb:

(lldb) target create "./Projucer"
Current executable set to './Projucer' (x86_64).
(lldb) run
Process 798 launched: './Projucer' (x86_64)
JUCE v4.3.1

**********************************************************
Projucer 4.3.1  ---  Build date: Apr  4 2017
Log started: 4 Apr 2017 10:52:56am

Mac OSX 10.12
CPU: 1400MHz  Cores: 4  8192MB
Loading project: /Users/walshr/sourcecode/cabaiste/CabbageIDE.jucer
JUCE Assertion failure in juce_Component.cpp:2854
Process 798 stopped
* thread #1: tid = 0x32aa, 0x000000010051c55f Projucer`juce::Component::grabKeyboardFocus(this=0x0000000101a48ae8) + 191 at juce_Component.cpp:2854, name = 'Juce Message Thread', queue = 'com.apple.main-thread', stop reason = EXC_BREAKPOINT (code=EXC_I386_BPT, subcode=0x0)
    frame #0: 0x000000010051c55f Projucer`juce::Component::grabKeyboardFocus(this=0x0000000101a48ae8) + 191 at juce_Component.cpp:2854
   2851	    // If this fails then you're probably trying to grab the focus before you've
   2852	    // added the component to a parent or made it visible. Or maybe one of its parent
   2853	    // components isn't yet visible.
-> 2854	    jassert (isShowing() || isOnDesktop());
   2855	}
   2856	
   2857	void Component::moveKeyboardFocusToSibling (const bool moveToNext)
(lldb) bt
* thread #1: tid = 0x32aa, 0x000000010051c55f Projucer`juce::Component::grabKeyboardFocus(this=0x0000000101a48ae8) + 191 at juce_Component.cpp:2854, name = 'Juce Message Thread', queue = 'com.apple.main-thread', stop reason = EXC_BREAKPOINT (code=EXC_I386_BPT, subcode=0x0)
  * frame #0: 0x000000010051c55f Projucer`juce::Component::grabKeyboardFocus(this=0x0000000101a48ae8) + 191 at juce_Component.cpp:2854
    frame #1: 0x000000010052209f Projucer`juce::Component::enterModalState(this=0x0000000101a48ae8, shouldTakeKeyboardFocus=true, callback=0x0000000000000000, deleteWhenDismissed=false) + 223 at juce_Component.cpp:1741
    frame #2: 0x0000000100664ec4 Projucer`juce::TemporaryMainMenuWithStandardCommands::TemporaryMainMenuWithStandardCommands(this=0x0000000101a48ad0) + 1844 at juce_mac_MainMenu.mm:527
    frame #3: 0x0000000100601a55 Projucer`juce::TemporaryMainMenuWithStandardCommands::TemporaryMainMenuWithStandardCommands(this=0x0000000101a48ad0) + 21 at juce_mac_MainMenu.mm:494
    frame #4: 0x000000010055c2e3 Projucer`juce::FileChooser::showPlatformDialog(results=0x00007fff5fbfe188, title=0x00007fff5fbfe170, currentFileOrDirectory=0x00007fff5fbfe180, filter=0x00007fff5fbfe178, selectsDirectory=false, selectsFiles=true, isSaveDialogue=false, (null)=false, selectMultipleFiles=false, treatFilePackagesAsDirs=false, extraInfoComponent=0x0000000000000000) + 195 at juce_mac_FileChooser.mm:151
    frame #5: 0x000000010055bd1d Projucer`juce::FileChooser::showDialog(this=0x00007fff5fbfe170, flags=5, previewComp=0x0000000000000000) + 701 at juce_FileChooser.cpp:109
    frame #6: 0x000000010055ba54 Projucer`juce::FileChooser::browseForFileToOpen(this=0x00007fff5fbfe170, previewComp=0x0000000000000000) + 36 at juce_FileChooser.cpp:45
    frame #7: 0x0000000100052531 Projucer`ProjucerApplication::askUserToOpenFile(this=0x000000010192fee0) + 161 at jucer_Application.cpp:572
    frame #8: 0x0000000100052394 Projucer`ProjucerApplication::perform(this=0x000000010192fee0, info=0x0000000101a6b1e8) + 228 at jucer_Application.cpp:542
    frame #9: 0x0000000100052a4c Projucer`non-virtual thunk to ProjucerApplication::perform(this=0x000000010192fee0, info=0x0000000101a6b1e8) + 44 at jucer_Application.cpp:537
    frame #10: 0x00000001005f6418 Projucer`juce::ApplicationCommandTarget::tryToInvoke(this=0x000000010192fee0, info=0x0000000101a6b1e8, async=false) + 184 at juce_ApplicationCommandTarget.cpp:67
    frame #11: 0x0000000100647b58 Projucer`juce::ApplicationCommandTarget::CommandMessage::messageCallback(this=0x0000000101a6b1d0) + 72 at juce_ApplicationCommandTarget.cpp:36
    frame #12: 0x000000010041b557 Projucer`juce::MessageQueue::deliverNextMessage(this=0x000000010192d7b0) + 103 at juce_osx_MessageQueue.h:89
    frame #13: 0x000000010041b4a6 Projucer`juce::MessageQueue::runLoopCallback(this=0x000000010192d7b0) + 54 at juce_osx_MessageQueue.h:100
    frame #14: 0x000000010041b375 Projucer`juce::MessageQueue::runLoopSourceCallback(info=0x000000010192d7b0) + 21 at juce_osx_MessageQueue.h:108
    frame #15: 0x00007fffc12f2551 CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
    frame #16: 0x00007fffc12d36bd CoreFoundation`__CFRunLoopDoSources0 + 557
    frame #17: 0x00007fffc12d2bb6 CoreFoundation`__CFRunLoopRun + 934
    frame #18: 0x00007fffc12d25b4 CoreFoundation`CFRunLoopRunSpecific + 420
    frame #19: 0x00007fffc0873f6c HIToolbox`RunCurrentEventLoopInMode + 240
    frame #20: 0x00007fffc0873ca9 HIToolbox`ReceiveNextEventCommon + 184
    frame #21: 0x00007fffc0873bd6 HIToolbox`_BlockUntilNextEventMatchingListInModeWithFilter + 71
    frame #22: 0x00007fffbef6a5f5 AppKit`_DPSNextEvent + 1093
    frame #23: 0x00007fffbf67a8eb AppKit`-[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 1637
    frame #24: 0x00007fffbef5efbd AppKit`-[NSApplication run] + 926
    frame #25: 0x000000010040d653 Projucer`juce::MessageManager::runDispatchLoop(this=0x000000010192d740) + 147 at juce_mac_MessageManager.mm:254
    frame #26: 0x000000010040d545 Projucer`juce::JUCEApplicationBase::main() + 389 at juce_ApplicationBase.cpp:248
    frame #27: 0x000000010040d359 Projucer`juce::JUCEApplicationBase::main(argc=1, argv=0x00007fff5fbffa38, customDelegate=0x0000000000000000) + 73 at juce_ApplicationBase.cpp:226
    frame #28: 0x00000001000538e7 Projucer`main(argc=1, argv=0x00007fff5fbffa38) + 55 at jucer_Main.cpp:67
    frame #29: 0x00007fffd6312255 libdyld.dylib`start + 1
    frame #30: 0x00007fffd6312255 libdyld.dylib`start + 1
(lldb) 

Anyone have any ideas what may be causing this?


#2

You mean ideas other than the big comment that’s right there explaining what’s causing it!

(Are you just hitting this when running in the projucer? It could be that because focus is a bit less straightforward in a live build, we should remove that assertion when running in there).


#3

Yes I’m hitting this when I run the Projucer straight out of Xcode. I’m not modifying anything, nor have I changed any settings anywhere. I also get it with one of my own apps. Everything was working fine for a me a few days ago. Could something on the system level be causing this? The same code works fine on Windows and Linux.


#4

oh, I see. Thought you meant this was code you were running in the projucer. OK, thanks, I’ll sort it out.


#5

I hope you can recreate the issue there yourselves…


#6

Thanks Jules. Everything is behaving fine again.