FileChooser crashes after some commit in JUCE master branch

Hello!

Using binary search, I found a commit in the JUCE master branch, and since this commit, I have a crash when trying to use FileChooser in my iOS application

Commit a4ba0c1
committed on Oct 29
“FileChooser: Fix deprecation warnings for iOS 14”

The app crashes with error

JUCE v8.0.3: Message Thread (1): EXC_BAD_ACCESS (code=1, address=0x6f6974646480b359)

on this function in juce_Windowing_ios.mm file

int juce_iOSMain (int argc, const char* argv[], void* customDelegatePtr)
{
    Class delegateClass = (customDelegatePtr != nullptr ? reinterpret_cast<Class> (customDelegatePtr) : [JuceAppStartupDelegate class]);

    return UIApplicationMain (argc, const_cast<char**> (argv), nil, NSStringFromClass (delegateClass));
}

this is call stack

I might have used FileChooser incorrectly, and I can share a code example later if needed

To save some time trying different combinations, please can you let me know:

  • Did you resave your JUCE project after updating your JUCE version?
  • What iOS version(s) exhibit the crash?
  • What is your iOS deployment target version?
  • Do you see the crash with the native filechooser, or the JUCE filechooser?
  • Does the app crash immediately on opening, or after attempting to open the file chooser, or something else?

I checked out the commit you linked, then tested the DemoRunner’s dialogs demo on iOS 18.1 Simulator with both native and JUCE filechoosers, and with deployment targets of iOS 12 and iOS 18, and those combinations seem to work as expected. So, I suspect that either the problem is only evident on older iOS versions, or maybe the project needs to be resaved.

Hi!

  • Did you resave your JUCE project after updating your JUCE version?
    —Yes
  • What iOS version(s) exhibit the crash?
    —17.7.1
  • What is your iOS deployment target version?
    —11.0
  • Do you see the crash with the native filechooser, or the JUCE filechooser?
    —native
  • Does the app crash immediately on opening, or after attempting to open the file chooser, or something else?
    —immediately on opening

I’m unable to repro the issue in the DemoRunner with that setup.

Note that the earliest supported iOS deployment target for JUCE 8 is iOS 12.

Please try running the DemoRunner and check whether that crashes. If the DemoRunner works as expected, then perhaps you can check for differences between your code and the code in the DialogsDemo.

I found this, with the wildcard, is crashing in iOS17 when the file chooser is opened. It wasn’t crashing in iOS16. →

fileChooser = std::make_unique<juce::FileChooser>(
        "Load Sample", defaultDirectory, audioReader.getWildCardForAllFormats(), true, false, samplePanelComponent);

fileChooser->launchAsync(flags, [&](**const** juce::FileChooser& chooser) {...

Using “” for the wildcard works fine in iOS17 →

fileChooser = std::make_unique<juce::FileChooser>(
        "Load Sample", defaultDirectory, "", true, false, samplePanelComponent);

Yes, I also found out what the issue is with the wildcard, but I haven’t figured it out completely yet.
If I use something like “.wav;.aiff;*.mp3”, everything works fine, but as soon as I add one or two more file types, it crashes.

I can reproduce this issue in the DemoRunner by replacing the empty wildcard with

"*.wav;*.aiff;*.flac;*.ogg;*.mp3;*.wma;*.aac;*.m4a"

or something like that

Thanks, I’m now able to reproduce this issue. I’ll update this thread once there’s a fix available.

1 Like

That’s fixed here. Thanks again for the report!

2 Likes