# Bug on FileChooser?

**URL:** <https://forum.juce.com/t/bug-on-filechooser/46630>\
**Category:** General JUCE discussion\
**Created:** [June 23, 2021, 12:29pm UTC](https://forum.juce.com/t/bug-on-filechooser/46630 "2021-06-23T12:29:49Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![yndurain](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/yndurain/32/3261_2.png) [@yndurain](https://forum.juce.com/u/yndurain)\
**Post date:** [June 23, 2021, 12:29pm UTC](https://forum.juce.com/t/bug-on-filechooser/46630/1 "2021-06-23T12:29:49Z")

</div>

Hi,

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?

Thx

---

<div class="post-metadata">

**Author:** ![reuk](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/reuk/32/21494_2.png) [@reuk](https://forum.juce.com/u/reuk)\
**Post date:** [June 23, 2021, 1:36pm UTC](https://forum.juce.com/t/bug-on-filechooser/46630/2 "2021-06-23T13:36:59Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![yndurain](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/yndurain/32/3261_2.png) [@yndurain](https://forum.juce.com/u/yndurain)\
**Post date:** [June 24, 2021, 8:04am UTC](https://forum.juce.com/t/bug-on-filechooser/46630/3 "2021-06-24T08:04:13Z")

</div>

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.

Thanks!

![JUCEdialogBroken](https://us1.discourse-cdn.com/flex026/uploads/juce/original/2X/4/4934edb3f9cc4d9b063db6df23428fb97daea9a1.gif)

---

<div class="post-metadata">

**Author:** ![reuk](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/reuk/32/21494_2.png) [@reuk](https://forum.juce.com/u/reuk)\
**Post date:** [June 24, 2021, 9:20am UTC](https://forum.juce.com/t/bug-on-filechooser/46630/4 "2021-06-24T09:20:06Z")

</div>

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.
