FilenameComponent hangs on folder select button

Hi to all,
I'm facing a hung when clicking on the FilenameComponent button to choose a valid folder.
I've tried many modifications, compared my software with the IntroJucer mudule updater example, all seems correct but of course I have something different.


My program hangs at this line 182 @ juce_win32_FileChooser.cpp:


  if (selectsDirectory)
    {
        BROWSEINFO bi = { 0 };
        bi.hwndOwner = (HWND) parentWindow.getWindowHandle();
        bi.pszDisplayName = files;
        bi.lpszTitle = title.toWideCharPointer();
        bi.lParam = (LPARAM) &info;
        bi.lpfn = browseCallbackProc;
       #ifdef BIF_USENEWUI
        bi.ulFlags = BIF_USENEWUI | BIF_VALIDATE;
       #else
        bi.ulFlags = 0x50;
       #endif

        LPITEMIDLIST list = SHBrowseForFolder (&bi);    // MY PROGRAM BLOCKS HERE...

        if (! SHGetPathFromIDListW (list, files))
        {
            files[0] = 0;
            info.returnedString = String::empty;
        }



These are the parameters I pass to the constructor:
 


    addAndMakeVisible (synReportsFolder = new FilenameComponent("synfc",                                                       
                                                                BRSettings::getInstance().getSynRptPath(),
                                                                true,
                                                                true,
                                                                false,
                                                                "*",
                                                                String::empty,
                                                                "Please choose a valid path"));

This FilenameComponet lives inside a content component of a DialogWindow, added to desktop in the following manner. the show method is static:

 


void BRConfigComponent::show (Component* mainWindow)
{
    DialogWindow::LaunchOptions o;
    o.content.setOwned (new BRConfigComponent());
    o.componentToCentreAround        = mainWindow;
    o.dialogTitle                   = "Settings";
    o.dialogBackgroundColour        = Colours::lightgrey;
    o.escapeKeyTriggersCloseButton  = true;
    o.useNativeTitleBar             = true;
    o.resizable                     = false;
        
    o.launchAsync();
}

Hope these infos help finding a possible solutions.

Thank you so much.

I've temporary solved my problem making this fix to juce_win32_FileChooser.cpp

 

       //#ifdef BIF_USENEWUI
       // bi.ulFlags = BIF_USENEWUI | BIF_VALIDATE;
       //#else
       // bi.ulFlags = 0x50;
       //#endif

       #ifdef BIF_USENEWUI
        bi.ulFlags = BIF_RETURNONLYFSDIRS;
       #else
        bi.ulFlags = 0x50;
       #endif

I don't know why.