Qt application does not terminate when QFileDialog is used



  • Hi everyone,

    I'm stuck in a weird behavior in Qt.

    I have a Qt project in windows where as soon as I use
    @QFileDialog::getOpenFileNames@

    then, exit the application, and the process keeps running in windows.
    This problem only occurs when I use Qt5.1.0-32bit in my 64bit PC.

    Everything works perfectly in Qt5.1.0-64 bit.

    I've tried to reinstall microsoft redistributable without success
    (I'm using VS2010 for 32 bit and VS2012 for 64 bit)

    I've also tried to call:
    @QApplication::exit(0);@

    but the application process does not stop.

    This is the stack once I exit the application and pause the debugger:
    @
    0 NtWaitForMultipleObjects ntdll32 0x7731015d
    1 WaitForMultipleObjectsEx KERNELBASE 0x750a15e9
    2 WaitForMultipleObjectsExImplementation kernel32 0x76bf19fc
    3 RealMsgWaitForMultipleObjectsEx USER32 0x7533086a
    4 CCliModalLoop::BlockFn callctrl.cxx 1222 0x76402bf1
    5 ModalLoop chancont.cxx 211 0x76402d31
    6 ThreadSendReceive channelb.cxx 4979 0x7651d2f6
    7 CRpcChannelBuffer::SwitchAptAndDispatchCall channelb.cxx 4454 0x7651d098
    8 CRpcChannelBuffer::SendReceive2 channelb.cxx 4076 0x7651cef0
    9 CCliModalLoop::SendReceive callctrl.cxx 899 0x76402cba
    10 CAptRpcChnl::SendReceive callctrl.cxx 583 0x76419aa1
    11 CCtxComChnl::SendReceive ctxchnl.cxx 734 0x76419b24
    12 NdrExtpProxySendReceive proxy.cxx 1932 0x7651ce06
    13 NdrpProxySendReceive RPCRT4 0x7567420b
    14 NdrClientCall2 RPCRT4 0x756f0149
    15 ObjectStublessClient stblsclt.cxx 474 0x7651c8e2
    16 ObjectStubless stubless.asm 154 0x764198ad
    17 RemoteReleaseRifRefHelper marshal.cxx 6770 0x7641b641
    18 RemoteReleaseRifRef marshal.cxx 6694 0x7641b5ed
    19 CStdMarshal::DisconnectCliIPIDs marshal.cxx 3964 0x7641b172
    20 CStdMarshal::Disconnect marshal.cxx 3273 0x7641a66e
    21 CStdIdentity::~CStdIdentity stdid.cxx 312 0x7641a817
    22 CStdIdentity::`scalar deleting destructor' ole32 0x7641a781
    23 CStdIdentity::CInternalUnk::Release stdid.cxx 767 0x7641aaf3
    24 IUnknown_Release_Proxy proxy.cxx 1773 0x7651d380
    25 FRMyRobots 0x50c44df
    26 LdrpCallInitRoutine ntdll32 0x773299a0
    27 LdrShutdownProcess ntdll32 0x7733d702
    28 RtlExitUserProcess ntdll32 0x7733d5a4
    29 ExitProcessStub kernel32 0x76bf79c4
    30 __crtExitProcess MSVCR100D 0x53fc859b
    31 __freeCrtMemory MSVCR100D 0x53fc8447
    32 exit MSVCR100D 0x53fc8092
    33 __tmainCRTStartup crtexe.c 568 0xc12f4a
    34 WinMainCRTStartup crtexe.c 371 0xc12cbf
    35 BaseThreadInitThunk kernel32 0x76bf336a
    36 __RtlUserThreadStart ntdll32 0x77329f72
    37 _RtlUserThreadStart ntdll32 0x77329f45
    @

    Does anyone know where this error comes from?
    Is this a bug?

    Thank you very much!


  • Moderators

    Hi,

    Can you try again with Qt 5.1.1? It is fully backward-compatible with Qt 5.1.0 with many bug fixes.

    http://qt-project.org/downloads



  • Hello JKSH,

    Thanks a lot for your reply.

    I've just installed and tried the latest Qt 5.1.1 VS2010 OpenGL 32 bits and I have the same problem. When I pause in debug mode, it shows the same stack.

    Any hints?

    Thank you,


  • Moderators

    Hmm... I can't think of anything at this point. Can you post a "Short, Self Contained, Compilable Example":http://sscce.org/? I'm happy to investigate a bit if you provide sample code.



  • I've just created a new GUI project from scratch, added a button in the MainWindow with the callback:

    @
    void MainWindow::on_pushButton_clicked(){
    QStringList list = QFileDialog::getOpenFileNames();
    }
    @

    I compile with VS2010 32 bit (Qt 5.1.1), press the button, click cancel on the filedialog and exit. And I have the same problem running on debug and release the call stack when I pause is the same, stopping at:

    @
    0 NtWaitForMultipleObjects ntdll32 0x7731015d
    @

    Everything works fine with the 64 bit version (VS2012).
    I've tried this in my 2 PC's running Windows 7 64 bits.

    The example is available "HERE":https://www.dropbox.com/sh/ryt2qi31859y3gl/2Pt4WWsG7u
    This must be either a problem with my 2 computers or a Qt bug...

    Thank you very much for your help,


  • Moderators

    I just remembered I don't have MSVC 2010 on my system anymore, sorry. I tried your example on MSVC 2012 x64 on Windows 8.1, and it quit properly. (However, when I closed the dialog, the main window also gets hidden behind Qt Creator. I think this is a bug).

    There have been other issues with Qt dialogs before (e.g. https://bugreports.qt-project.org/browse/QTBUG-32821 ), but I don't know if your issue is related. This workaround helped me; you can try it:

    Rename your slot from on_pushButton_clicked() to something else, like openDialog().

    #In your MainWindow Constructor, make an explicit queued connection:
    @
    connect(ui->pushButton, SIGNAL(clicked()), this, SLOT(openDialog()), Qt::QueuedConnection);
    @

    Anyway, have you installed the Service Pack 1 for MSVC 2010? It came with some "bug fixes for the C++ compiler":http://support.microsoft.com/kb/983509 -- perhaps it was an issue with the MSVC compiler.

    Note: The SP1 installer has its quirks. If I remember correctly, I have to uninstall all VC++ 2010 Redistributables first.

    If these still doesn't resolve your issue, file a report at http://bugreports.qt-project.org/ (and attach your example one a .zip file, not a DropBox link)



  • Hi JKSH,
    I already had VS2010 SP1 (edited) installed. I never wondered why the window gets hidden after a QFileDialog is used. But I realised that you can quickly fix it raising your QWidget:
    @
    QStringList list = QFileDialog::getOpenFileNames();
    this->raise();
    @
    However it is not very fancy because the window gets hidden and then it comes to the top. I do not know of a better fix.

    The queued signal connection did not solve my problem...
    I'll then file a bug report.

    Thank you very much for all your help!


  • Moderators

    You're welcome :)

    [quote]I already had VS2010 installed.[/quote]Original version, or SP1?

    [quote]I’ll then file a bug report.[/quote]Please post the link to the report here, so that others can follow it if they have the same issue.



  • Sorry, I meant VS2010 SP1 :)
    I just edited the post.

    This is the link to the bug report:
    "https://bugreports.qt-project.org/browse/QTBUG-34790":https://bugreports.qt-project.org/browse/QTBUG-34790


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.