JUCE 6.0.8 BUG: FileChooser Win Native not working


I just updated to JUCE 6.0.8.
And I found out that it breaks the native Windows file chooser.
Once I select a folder in the chooser, the UI freezes and I have to force quit the application.
The bug is easy to reproduce with a test application. (See also attached example application).

More details:
I am using the asynchronous version of the FileChooser class. I.e. I am calling FileChooser::launchAsync()
I can see that the file chooser successfully returns to run the lambda. But once the lambda is done it gets stuck somewhere in the JUCE code. And the whole UI is no longer responsive.
As far as I can see, it does not manage to get out of the destructor for ~Win32NativeFileChooser()

When I revert my JUCE version to 6.0.7, the bug is gone. So something must have changed in JUCE 6.0.8 to cause this bug.

Here is the code I use to start the file chooser dialog:

TestPluginAudioProcessorEditor::TestPluginAudioProcessorEditor (TestPluginAudioProcessor& p)
    : AudioProcessorEditor (&p), processor (p)
    fileChooserButton.setButtonText("Choose Directory");

    fileChooserButton.onClick = [this]()
        libDirChooser = std::make_unique<FileChooser>("Select directory...", juce::File("C:\\"));
        libDirChooser->launchAsync(FileBrowserComponent::openMode | FileBrowserComponent::canSelectDirectories,
            [this](const FileChooser& fileChooser)
            auto file = fileChooser.getResult();
            if (file.exists())
                String libDirString = file.getFullPathName();
                DBG("Done with async file chooser.");

    setSize (500, 400);

You can reproduce the bug with the attached test application.
Just run the app in stand-alone mode and click on the “Choose Directory” button.
In the file chooser select a directory and confirm.
As as a result the UI is completely frozen and you cannot even quit the app normally anymore.

FileChooserBug.zip (5.2 KB)


We seem to be experiencing a similar issue here - the change in behaviour seems to coincide with commit 3afaaa48be41f0d57550e989b4969283b8503861 on 4 Mar.

Thanks for proving my sanity, Unlinked1.
And thanks for finding out the commit which caused this.
Hope the JUCE devs can take a look at that soon :slight_smile:

1 Like

Thanks for reporting. I’m aiming to look at this next week, so I’ll update this thread once I’ve made some progress.

1 Like

Thanks, sounds great!

I’ve put together a potential fix for this, but I’m a bit nervous about releasing it just before the bank holiday weekend. We’re currently aiming to merge this at some point next week.

1 Like

“Never release on a Friday” needs to be multiplied 10x when it comes to long weekends!

1 Like

No hurry. Next week sounds absolutely fine to me.
And thanks for looking into this :slight_smile:

The issue should be resolved by this commit:

Please try it out and let me know if you run into any further issues.

Just tested. It’s working fine here now.

1 Like