Important: Please read the Qt Code of Conduct -

FileDialog crashes sometimes in Debug, seems to behave ok in Release

  • So this is a very ghostly bug... or else

    Code is very simple:
    @#include <QQmlApplicationEngine>
    #include <QGuiApplication>

    int main(int argc, char **argv)
    QGuiApplication app(argc, argv);
    QQmlApplicationEngine engine;
    return app.exec();

    @import QtQuick 2.1
    import QtQuick.Controls 1.0
    import QtQuick.Dialogs 1.0

    ApplicationWindow {
    id: app
    visible: true

    width: 800
    height: 600

    menuBar: MenuBar {
    Menu {
    title: "File"
    MenuItem {
    text: "Open"
    shortcut: "Ctrl+O"
    onTriggered: app.openDoc()

    FileDialog {
    id: fileOpener
    title: "Select a file to be opened"
    nameFilters: "*.py"
    selectExisting: true
    selectFolder: false
    selectMultiple: false

    function openDoc() {

    Crashes sometimes(not always and very dependent on phase of moon) when the user closes the file dialog while in debug mode. The probability of crash is increased, if the program is running under debugger. After the crash, there is NO CALL STACK VISIBLE under VS debugger(the RIP register was == 0, and it just had one entry with addr==0), however i tried to restore where the problem was by reading what was in [rsp]. It was a function
    @template <class BaseClass>
    void QWindowsDialogHelperBase<BaseClass>::hide()
    000007FEDC8EF2C0 mov qword ptr [rsp+8],rcx
    000007FEDC8EF2C5 sub rsp,28h
    if (m_nativeDialog)
    000007FEDC8EF2C9 mov rax,qword ptr [this]
    000007FEDC8EF2CE cmp qword ptr [rax+20h],0
    000007FEDC8EF2D3 je QWindowsDialogHelperBase<QPlatformFileDialogHelper>::hide+2Dh (07FEDC8EF2EDh)
    000007FEDC8EF2D5 mov rax,qword ptr [this]
    000007FEDC8EF2DA mov rax,qword ptr [rax+20h]
    000007FEDC8EF2DE mov rcx,qword ptr [this]
    000007FEDC8EF2E3 mov rcx,qword ptr [rcx+20h]
    000007FEDC8EF2E7 mov rax,qword ptr [rax]
    000007FEDC8EF2EA call qword ptr [rax+68h]
    m_ownerWindow = 0;
    000007FEDC8EF2ED mov rax,qword ptr [this] // <<< [RSP] points here
    m_ownerWindow = 0;
    000007FEDC8EF2F2 mov qword ptr [rax+28h],0

    Here the rest of my environment specs that may be useful:

    • VS 2012 Ultimate (Update 3)
    • Qt 5.1 downloaded from qt-project, for Win 64bit, VS12, OpenGL
    • build with CMake 2.8.11(i couldnt reproduce it just yet with QtCreator)
      @cmake_minimum_required(VERSION 2.8.11)
      set (CMAKE_PREFIX_PATH "C:\Program Files (x86)\Windows Kits\8.0\Lib\win8\um\x64")


    find_package(Qt5Widgets REQUIRED)


    set(target delicious)

    set (Sources

    add_executable(${target} ${Sources})

    qt5_use_modules(${target} Qml Quick)@

    I would like to see if someone else could reproduce this behaviour... under different qt builds and settings perhaps, because right now i can't debug my QtQuick project and i really need to?

  • Similar behaviour here: on closing FileDialog it crashes. It is indifferent if the user selects a file or cancels. It crashes on Debug and Release randomly, more or less half of the time.
    Sometimes call stack appears and goes deep inside qwindows plugin.

    My configuration:
    Qt 5.1 with OpenGL for Visual Studio 2012 (downlaoded), cmake 2.8.11

  • It is interesting to see that there are recently problems with the static methods of QFileDialog reported.

    This one has windows as the commonality "to my problem posted": end of last year.
    With Windows 7 64 bit, msvc 2005 and Qt 4.7.2 this was. Changing to MinGW and Qt4.8.0 "solved" the problem.

    Wondering if there is an issue in the windows API?

    Yesterday, there was "another recent report": but on linux. This is certainly less likely related since the OS is different in addition to other things. So, just adding for completion.

  • There is a "bug report": referenced. The bug report is on windows with Qt 5.1.

Log in to reply