Bug on FileChooser?


I found something odd in FileChooser. If I run it with useNativeBox = true and don’t select any files (press cancel), it crashes. Well, I think it gets blocked.

Same code with useNativeBox = false works fine.

In my class I have the member:
std::unique_ptr fc;

and when a button is clicked I do

            fc.reset(new FileChooser("Choose a firmware image to open...", initialFile, "*.txt", **true**));
            fc->launchAsync(FileBrowserComponent::openMode | FileBrowserComponent::canSelectFiles,
                            [this](const FileChooser &chooser) {
                                String                 chosen;
                                juce::Array<juce::URL> results = chooser.getURLResults();

                                if (results.size() > 0)

I get the same result in the DemoRunner.exe.

Any ideas about how to solve this?


I just tested the DialogsDemo on Windows 10 version 21H1. Clicking the 'Load' File Browser button and then immediately clicking Cancel seems to work as expected. The browser closes, and a new dialog opens showing the (empty) list of selected files.

Please check that the issue is present with the very latest version of JUCE’s develop branch. If it is, please provide the Windows version you’re using so that I can attempt to reproduce the issue.

Hi reuk,

So I got both versions from github, in the gif attached you can see that the top one (develop) works fine.
The bottom one (master) hangs after I press cancel not letting me move the screen or click any buttons.

Both have been dowloaded as a zip from github and build/run from visualStudio2019 projects

On the top you can see my windows version.



OK, thanks for trying with develop. It sounds like the issue has been fixed, and this fix will make its way to the master branch in the near future.

1 Like