Mac File Chooser assertion


#1

Hi, 

I'm seeing a failure in the FileChooser under OS X 10.10.1 with Xcode 6.1 and JUCE 3.1 (it was also happening yesterday pre the 3.1 commits).

Showing the FileChooser like this:

FileChooser myChooser("Please choose a valid Hull preset.", File::getSpecialLocation(File::userHomeDirectory), "*.hullsynthpreset");


if (myChooser.browseForFileToOpen())
{
    File selectedFile = myChooser.getResult();
    XmlDocument myDocument(selectedFile.loadFileAsString());
    XmlElement* mainElement = myDocument.getDocumentElement();
    if (mainElement != NULL)
    {
        filter->setStateInformationFromXml(mainElement);
    }
}

I get the following crash - which looks like something is modifying an NSMutableArray while it's being enumerated.


2014-11-19 09:50:52.645 Hull[24361:2307407] *** Collection <__NSArrayM: 0x25cdbafd0> was mutated while being enumerated.
2014-11-19 09:50:52.653 Hull[24361:2307407] (
    0   CoreFoundation                      0x00007fff9c06864c __exceptionPreprocess + 172
    1   libobjc.A.dylib                     0x00007fff924e36de objc_exception_throw + 43
    2   CoreFoundation                      0x00007fff9c067ee5 __NSFastEnumerationMutationHandler + 309
    3   AppKit                              0x00007fff93743c24 -[NSView _recursiveSendViewDidChangeAppearance:] + 193
    4   AppKit                              0x00007fff93743c3b -[NSView _recursiveSendViewDidChangeAppearance:] + 216
    5   AppKit                              0x00007fff93743c3b -[NSView _recursiveSendViewDidChangeAppearance:] + 216
    6   AppKit                              0x00007fff93743c3b -[NSView _recursiveSendViewDidChangeAppearance:] + 216
    7   AppKit                              0x00007fff93743c3b -[NSView _recursiveSendViewDidChangeAppearance:] + 216
    8   AppKit                              0x00007fff93743c3b -[NSView _recursiveSendViewDidChangeAppearance:] + 216
    9   AppKit                              0x00007fff93743c3b -[NSView _recursiveSendViewDidChangeAppearance:] + 216
    10  AppKit                              0x00007fff93743c3b -[NSView _recursiveSendViewDidChangeAppearance:] + 216
    11  AppKit                              0x00007fff93743c3b -[NSView _recursiveSendViewDidChangeAppearance:] + 216
    12  AppKit                              0x00007fff93743c3b -[NSView _recursiveSendViewDidChangeAppearance:] + 216
    13  AppKit                              0x00007fff93743c3b -[NSView _recursiveSendViewDidChangeAppearance:] + 216
    14  AppKit                              0x00007fff93743c3b -[NSView _recursiveSendViewDidChangeAppearance:] + 216
    15  AppKit                              0x00007fff93743c3b -[NSView _recursiveSendViewDidChangeAppearance:] + 216
    16  AppKit                              0x00007fff93743c3b -[NSView _recursiveSendViewDidChangeAppearance:] + 216
    17  AppKit                              0x00007fff93743c3b -[NSView _recursiveSendViewDidChangeAppearance:] + 216
    18  AppKit                              0x00007fff93743c3b -[NSView _recursiveSendViewDidChangeAppearance:] + 216
    19  AppKit                              0x00007fff93743941 -[NSView setAppearance:] + 205
    20  AppKit                              0x00007fff93d4605c -[NSThemeFrame setAppearance:] + 52
    21  AppKit                              0x00007fff936c23ca -[NSWindow setAppearance:] + 44
    22  AppKit                              0x00007fff93c25f93 +[NSSavePanel _crunchyRawUnbonedPanel] + 298
    23  Hull                                0x00000001003caa03 _ZN4juce11FileChooser18showPlatformDialogERNS_5ArrayINS_4FileENS_20DummyCriticalSectionELi0EEERKNS_6StringERKS2_S8_bbbbbPNS_20FilePreviewComponentE + 899
    24  Hull                                0x00000001003ca1af _ZN4juce11FileChooser10showDialogEiPNS_20FilePreviewComponentE + 751
    25  Hull                                0x00000001003c9eb4 _ZN4juce11FileChooser19browseForFileToOpenEPNS_20FilePreviewComponentE + 36
    26  Hull                                0x000000010005a07f _ZN24HullAudioProcessorEditor13buttonClickedEPN4juce6ButtonE + 1951
    27  Hull                                0x000000010005a35f _ZThn224_N24HullAudioProcessorEditor13buttonClickedEPN4juce6ButtonE + 47
    28  Hull                                0x000000010045ac06 _ZN4juce12ListenerListINS_6Button8ListenerENS_5ArrayIPS2_NS_20DummyCriticalSectionELi0EEEE11callCheckedINS_9Component14BailOutCheckerEPS1_EEvRKT_MS2_FvT0_ENS_11TypeHelpers13ParameterTypeISF_E4typeE + 214
    29  Hull                                0x00000001003a7344 _ZN4juce6Button16sendClickMessageERKNS_12ModifierKeysE + 308
    30  Hull                                0x00000001003a6f46 _ZN4juce6Button14setToggleStateEbNS_16NotificationTypeE + 470
    31  Hull                                0x00000001003a79a0 _ZN4juce6Button21internalClickCallbackERKNS_12ModifierKeysE + 144
    32  Hull                                0x00000001003a7f9b _ZN4juce6Button7mouseUpERKNS_10MouseEventE + 155
    33  Hull                                0x000000010039b8b9 _ZN4juce9Component15internalMouseUpENS_16MouseInputSourceENS_5PointIfEENS_4TimeENS_12ModifierKeysE + 585
    34  Hull                                0x00000001004c6276 _ZN4juce24MouseInputSourceInternal11sendMouseUpERNS_9ComponentENS_5PointIfEENS_4TimeENS_12ModifierKeysE + 198
    35  Hull                                0x00000001004c5ce3 _ZN4juce24MouseInputSourceInternal10setButtonsENS_5PointIfEENS_4TimeENS_12ModifierKeysE + 755
    36  Hull                                0x0000000100457c07 _ZN4juce24MouseInputSourceInternal11handleEventERNS_13ComponentPeerENS_5PointIfEENS_4TimeENS_12ModifierKeysE + 583
    37  Hull                                0x000000010039e69f _ZN4juce16MouseInputSource11handleEventERNS_13ComponentPeerENS_5PointIfEExNS_12ModifierKeysE + 127
    38  Hull                                0x0000000100442ef9 _ZN4juce13ComponentPeer16handleMouseEventEiNS_5PointIfEENS_12ModifierKeysEx + 185
    39  Hull                                0x00000001004cc343 _ZN4juce19NSViewComponentPeer14sendMouseEventEP7NSEvent + 115
    40  Hull                                0x00000001004cc8b9 _ZN4juce19NSViewComponentPeer15redirectMouseUpEP7NSEvent + 105
    41  Hull                                0x00000001004c92ec _ZN4juce15JuceNSViewClass12asyncMouseUpEP11objc_objectP13objc_selectorP7NSEvent + 60
    42  Hull                                0x00000001004c9277 _ZN4juce15JuceNSViewClass7mouseUpEP11objc_objectP13objc_selectorP7NSEvent + 55
    43  AppKit                              0x00007fff93dab02b -[NSWindow _reallySendEvent:] + 759
    44  AppKit                              0x00007fff9383850c -[NSWindow sendEvent:] + 368
    45  AppKit                              0x00007fff937ea096 -[NSApplication sendEvent:] + 2238
    46  AppKit                              0x00007fff93676e98 -[NSApplication run] + 711
    47  Hull                                0x0000000100277450 _ZN4juce14MessageManager15runDispatchLoopEv + 144
    48  Hull                                0x000000010027733f _ZN4juce19JUCEApplicationBase4mainEv + 415
    49  Hull                                0x000000010027713c _ZN4juce19JUCEApplicationBase4mainEiPPKc + 60
    50  Hull                                0x0000000100062363 main + 51
    51  Hull                                0x0000000100001db4 start + 52
    52  ???                                 0x0000000000000003 0x0 + 3
)

​

I did some debugging and it's causing an exception breakpoint in juce_mac_FileChooser.m line 139 when it invokes [NSOpenPanel openPanel]. 

Has anyone else seen this, is it an OS X Cocoa bug? I know I'm kinda on the bleeding edge with my OS X verison.

regards

peter