Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

[solved] QFileDialog 5 second delay after Open/Save/Close



  • I'm working with QFIleDialog, but somehow dialog.exec() hangs the application for ~5 seconds on any action exiting the dialog.

    I'm using Windows 7x64, and it happens in some other applications for the first time. Qt has it always.
    It also happens on some other workstations around. Which makes it even more random.

    Any clues? Since using "Windows" and "Hangs" in google does not result in very useful results.

    Minimal example: a new Qt 5.4.1 project with 1 button in QMainWindow

    void MainWindow::on_pushButton_clicked()
    {
        QStringList filters;
        filters << "Loadbank Sequence File (*.lsf)";
        filters << "All files (*)";
        QFileDialog dialog(this, "Select file", "/", "");
        dialog.setNameFilters(filters);
        dialog.setFileMode(QFileDialog::ExistingFile);
        dialog.exec();
        qDebug() << "done";
    }
    

    I've used procmon to see what the actions are:

    • Thread Exit (from the dialog I suppose_
    • Accessing "Tablet PC" registry keys.
    • Close file:C:\Windows\winsxs\x86_microsoft.windows.common-controls_6595b64144ccf1df_6.0.7601.18837_none_41e855142bd5705d
    • Accessing the file requested by the dialog, this is after dialog.exe().

  • Lifetime Qt Champion

    This post is deleted!

  • Moderators

    It's hard to pinpoint such problems but I remember vaguely something similar happened to me few years back.
    Back then the issue turned out to be multiple network drives (some of them unreachable) mapped in the user's computer taking ages to resolve or timeout. Apart from obviously suggesting to remove the unreachable network locations one thing I did was initially point the dialog to a "more useful" location than "/", such as QStandardPaths::DocumentsLocation, which avoided the problem altogether.

    The issue might be different here, like some 3rd party shell extensions going rogue, but a solution might be the same. Try pointing the dialog to a "safer" location and see if that helps.



  • I've played with all the extensions, turn on, off. uninstall antivirus and such.
    The problem seemed gone when a extension was turned off. But when you turn any different extension for explorer, Like dropbox, greenshop, owncloud, copy, cloud station, autohotkey scripts. The problem returned.

    At last I played around with the Windows Performance Recorder and Analyzer. Then it became apparent that there was a large number of network requests made.

    I removed Network Folders (not drives, folders) from "My Computer", and the problems seems gone. Not solved, because if I create the locations again, it returns.

    Workaround: create a batch script to "mount" network drives only they are actually available.
    Windows still keeps to amaze me. "Basic" features existing for decades still have these simple problems.


  • Lifetime Qt Champion

    @Jeroen3

    yep,

    And to my surprise, one can have 15 overlay icons. 11 for free use.
    So when trying to use my sub version, it cannot show status of files as dropbox and such
    program used all my overlay icons :)

    To be fair, win 8 does handle stale net location better than win 7.


  • Lifetime Qt Champion

    @Jeroen3

    Did you ever try the DontUseCustomDirectoryIcons option to see if that would speed it up ?


Log in to reply