Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QFileDialog::getOpenFileName causing program to crash
QtWS25 Last Chance

QFileDialog::getOpenFileName causing program to crash

Scheduled Pinned Locked Moved Unsolved General and Desktop
26 Posts 12 Posters 5.5k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J JonB
    21 Feb 2023, 12:53

    @BogdanPopa
    No, they mean delete the build output folder, for whichever debug/release you are building.

    B Offline
    B Offline
    BogdanPopa
    wrote on 21 Feb 2023, 14:23 last edited by
    #7

    @JonB I tried this now. The same error occurs.

    1 Reply Last reply
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 21 Feb 2023, 20:34 last edited by
      #8

      Can you show the backtrace of your crash ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      B 1 Reply Last reply 22 Feb 2023, 12:27
      0
      • S SGaist
        21 Feb 2023, 20:34

        Can you show the backtrace of your crash ?

        B Offline
        B Offline
        BogdanPopa
        wrote on 22 Feb 2023, 12:27 last edited by
        #9

        @SGaist

        1 RaiseException 0x7ffb0837cd29
        2 on_avast_dll_unload 0x7ffac8365310
        3 ashShell!DllCanUnloadNow 0x7ffac82ec6d8
        4 ?? 0x7ffac81d4419
        5 ashShell!DllCanUnloadNow 0x7ffac81d8971
        6 on_avast_dll_unload 0x7ffac83132be
        7 ntdll!RtlActivateActivationContextUnsafeFast 0x7ffb0a949a1d
        8 ntdll!LdrGetProcedureAddressEx 0x7ffb0a99c2f7
        9 ntdll!LdrGetProcedureAddressEx 0x7ffb0a99c08a
        10 ntdll!RtlSwitchedVVI 0x7ffb0a96d987
        11 ntdll!RtlGetFullPathName_UstrEx 0x7ffb0a94fbae
        12 ntdll!RtlDosPathNameToNtPathName_U 0x7ffb0a9473e4
        13 ntdll!LdrLoadDll 0x7ffb0a946af4
        14 ?? 0x7ffac8a3291c
        15 LoadLibraryExW 0x7ffb083854c2
        16 combase!WindowsPreallocateStringBuffer 0x7ffb09c76b4d
        17 combase!WindowsPreallocateStringBuffer 0x7ffb09c76a96
        18 combase!WindowsPreallocateStringBuffer 0x7ffb09c76868
        19 combase!WindowsPreallocateStringBuffer 0x7ffb09c764aa
        20 combase!SetErrorInfo 0x7ffb09c49660
        21 combase!CoGetTreatAsClass 0x7ffb09cb5a6d
        22 combase!CoGetTreatAsClass 0x7ffb09cb53e6
        23 combase!StringFromGUID2 0x7ffb09c619e0
        24 combase!CoGetTreatAsClass 0x7ffb09cb5bec
        25 combase!CoDisableCallCancellation 0x7ffb09cf1e78
        26 combase!CoRegisterMessageFilter 0x7ffb09cf6d80
        27 combase!CoTaskMemRealloc 0x7ffb09cef2e1
        28 combase!CoDisableCallCancellation 0x7ffb09cf20b0
        29 combase!StringFromGUID2 0x7ffb09c619e0
        30 combase!StringFromGUID2 0x7ffb09c5dc4f
        31 combase!StringFromGUID2 0x7ffb09c619e0
        32 combase!CoCreateInstance 0x7ffb09c4bd2a
        33 combase!CoCreateInstance 0x7ffb09c4a7d0
        34 combase!CoCreateInstance 0x7ffb09c4a52c
        35 ?? 0x7ffac8a33c5a
        36 SHEvaluateSystemCommandTemplate 0x7ffb089d9457
        37 SHEvaluateSystemCommandTemplate 0x7ffb089e4870
        38 SHEvaluateSystemCommandTemplate 0x7ffb089e46e6
        39 SHELL32!OpenAs_RunDLLA 0x7ffb08a05cd0
        40 SHELL32!OpenAs_RunDLLA 0x7ffb08a05785
        41 SHEnableServiceObject 0x7ffb08a04b9d
        42 SHELL32!SHCreateAssociationRegistration 0x7ffb08a2a3c3
        43 SHELL32_AddToFrontIconTable 0x7ffb089b3e36
        44 SHELL32_IconOverlayManagerInit 0x7ffb089b35dd
        45 Windows.Storage!SHGetFolderPathAndSubDirW 0x7ffb06214711
        46 Windows.Storage!SHTestTokenMembership 0x7ffb061ca187
        47 Windows.Storage!SHTestTokenMembership 0x7ffb061ca367
        48 EXPLORERFRAME!DllGetClassObject 0x7ffacc663581
        49 EXPLORERFRAME!DllGetClassObject 0x7ffacc6264fb
        50 EXPLORERFRAME!DllGetClassObject 0x7ffacc65b302
        51 Windows.Storage!ILCloneFirst 0x7ffb061a481c
        52 Windows.Storage!ILCloneFirst 0x7ffb061a4461
        53 Windows.Storage!SHGetFolderPathAndSubDirW 0x7ffb06214ad4
        54 SHCORE!DllCanUnloadNow 0x7ffb0a363106
        55 ntdll!TpSetPoolStackInformation 0x7ffb0a99fcd3
        56 ntdll!TpReleaseCleanupGroupMembers 0x7ffb0a9831aa
        57 KERNEL32!BaseThreadInitThunk 0x7ffb096a7614
        58 ntdll!RtlUserThreadStart 0x7ffb0a9826a1
        59 ??

        J 1 Reply Last reply 22 Feb 2023, 13:03
        0
        • B BogdanPopa
          22 Feb 2023, 12:27

          @SGaist

          1 RaiseException 0x7ffb0837cd29
          2 on_avast_dll_unload 0x7ffac8365310
          3 ashShell!DllCanUnloadNow 0x7ffac82ec6d8
          4 ?? 0x7ffac81d4419
          5 ashShell!DllCanUnloadNow 0x7ffac81d8971
          6 on_avast_dll_unload 0x7ffac83132be
          7 ntdll!RtlActivateActivationContextUnsafeFast 0x7ffb0a949a1d
          8 ntdll!LdrGetProcedureAddressEx 0x7ffb0a99c2f7
          9 ntdll!LdrGetProcedureAddressEx 0x7ffb0a99c08a
          10 ntdll!RtlSwitchedVVI 0x7ffb0a96d987
          11 ntdll!RtlGetFullPathName_UstrEx 0x7ffb0a94fbae
          12 ntdll!RtlDosPathNameToNtPathName_U 0x7ffb0a9473e4
          13 ntdll!LdrLoadDll 0x7ffb0a946af4
          14 ?? 0x7ffac8a3291c
          15 LoadLibraryExW 0x7ffb083854c2
          16 combase!WindowsPreallocateStringBuffer 0x7ffb09c76b4d
          17 combase!WindowsPreallocateStringBuffer 0x7ffb09c76a96
          18 combase!WindowsPreallocateStringBuffer 0x7ffb09c76868
          19 combase!WindowsPreallocateStringBuffer 0x7ffb09c764aa
          20 combase!SetErrorInfo 0x7ffb09c49660
          21 combase!CoGetTreatAsClass 0x7ffb09cb5a6d
          22 combase!CoGetTreatAsClass 0x7ffb09cb53e6
          23 combase!StringFromGUID2 0x7ffb09c619e0
          24 combase!CoGetTreatAsClass 0x7ffb09cb5bec
          25 combase!CoDisableCallCancellation 0x7ffb09cf1e78
          26 combase!CoRegisterMessageFilter 0x7ffb09cf6d80
          27 combase!CoTaskMemRealloc 0x7ffb09cef2e1
          28 combase!CoDisableCallCancellation 0x7ffb09cf20b0
          29 combase!StringFromGUID2 0x7ffb09c619e0
          30 combase!StringFromGUID2 0x7ffb09c5dc4f
          31 combase!StringFromGUID2 0x7ffb09c619e0
          32 combase!CoCreateInstance 0x7ffb09c4bd2a
          33 combase!CoCreateInstance 0x7ffb09c4a7d0
          34 combase!CoCreateInstance 0x7ffb09c4a52c
          35 ?? 0x7ffac8a33c5a
          36 SHEvaluateSystemCommandTemplate 0x7ffb089d9457
          37 SHEvaluateSystemCommandTemplate 0x7ffb089e4870
          38 SHEvaluateSystemCommandTemplate 0x7ffb089e46e6
          39 SHELL32!OpenAs_RunDLLA 0x7ffb08a05cd0
          40 SHELL32!OpenAs_RunDLLA 0x7ffb08a05785
          41 SHEnableServiceObject 0x7ffb08a04b9d
          42 SHELL32!SHCreateAssociationRegistration 0x7ffb08a2a3c3
          43 SHELL32_AddToFrontIconTable 0x7ffb089b3e36
          44 SHELL32_IconOverlayManagerInit 0x7ffb089b35dd
          45 Windows.Storage!SHGetFolderPathAndSubDirW 0x7ffb06214711
          46 Windows.Storage!SHTestTokenMembership 0x7ffb061ca187
          47 Windows.Storage!SHTestTokenMembership 0x7ffb061ca367
          48 EXPLORERFRAME!DllGetClassObject 0x7ffacc663581
          49 EXPLORERFRAME!DllGetClassObject 0x7ffacc6264fb
          50 EXPLORERFRAME!DllGetClassObject 0x7ffacc65b302
          51 Windows.Storage!ILCloneFirst 0x7ffb061a481c
          52 Windows.Storage!ILCloneFirst 0x7ffb061a4461
          53 Windows.Storage!SHGetFolderPathAndSubDirW 0x7ffb06214ad4
          54 SHCORE!DllCanUnloadNow 0x7ffb0a363106
          55 ntdll!TpSetPoolStackInformation 0x7ffb0a99fcd3
          56 ntdll!TpReleaseCleanupGroupMembers 0x7ffb0a9831aa
          57 KERNEL32!BaseThreadInitThunk 0x7ffb096a7614
          58 ntdll!RtlUserThreadStart 0x7ffb0a9826a1
          59 ??

          J Offline
          J Offline
          JonB
          wrote on 22 Feb 2023, 13:03 last edited by
          #10

          @BogdanPopa said in QFileDialog::getOpenFileName causing program to crash:

          2 on_avast_dll_unload 0x7ffac8365310

          Try disabling your Avast virus protector and see if it goes away?

          B 1 Reply Last reply 22 Feb 2023, 16:41
          2
          • J JonB
            22 Feb 2023, 13:03

            @BogdanPopa said in QFileDialog::getOpenFileName causing program to crash:

            2 on_avast_dll_unload 0x7ffac8365310

            Try disabling your Avast virus protector and see if it goes away?

            B Offline
            B Offline
            BogdanPopa
            wrote on 22 Feb 2023, 16:41 last edited by
            #11

            @JonB I have also tried this and still no result

            J 1 Reply Last reply 22 Feb 2023, 16:55
            0
            • B BogdanPopa
              22 Feb 2023, 16:41

              @JonB I have also tried this and still no result

              J Offline
              J Offline
              JonB
              wrote on 22 Feb 2023, 16:55 last edited by
              #12

              @BogdanPopa
              Then I would expect you to be able to post a stack trace which does not show it dying in on_avast_dll_unload?

              C 1 Reply Last reply 22 Feb 2023, 21:47
              2
              • J JonB
                22 Feb 2023, 16:55

                @BogdanPopa
                Then I would expect you to be able to post a stack trace which does not show it dying in on_avast_dll_unload?

                C Offline
                C Offline
                crackysk
                wrote on 22 Feb 2023, 21:47 last edited by
                #13

                I'm having similar issue as @BogdanPopa mentioned above.
                Using QFileDialog::getSaveFileName instead of Open, but same concept...
                Also, initial backtrace looked similar and contained avast detail, but managed to get past it and get a complete backtrace that has more sense...

                1  ntdll!RtlCompareMemoryUlong                                                                   0x7ff8dab71aa0 
                2  ntdll!RtlAllocateHeap                                                                         0x7ff8daafdd00 
                3  ntdll!RtlAllocateHeap                                                                         0x7ff8daafb44d 
                4  ntdll!RtlRegisterSecureMemoryCacheCallback                                                    0x7ff8dabc8c38 
                5  ntdll!RtlAllocateHeap                                                                         0x7ff8daafd255 
                6  ntdll!RtlAllocateHeap                                                                         0x7ff8daafb44d 
                7  Windows.Storage!CFreeThreadedItemContainer_CreateInstance                                     0x7ff8d635ba26 
                8  Windows.Storage!CFreeThreadedItemContainer_CreateInstance                                     0x7ff8d635b4be 
                9  Windows.Storage!CCachedShellItem_CreateInstance                                               0x7ff8d635a3d2 
                10 Windows.Storage!ILFindLastID                                                                  0x7ff8d636fc65 
                11 Windows.Storage!SHCreateShellItemArrayFromIDLists                                             0x7ff8d640323f 
                12 Windows.Storage!SHChangeNotification_Lock                                                     0x7ff8d6414537 
                13 EXPLORERFRAME!DllGetClassObject                                                               0x7ff8a4a08a46 
                14 EXPLORERFRAME!DllCanUnloadNow                                                                 0x7ff8a4a7d52a 
                15 ??                                                                                            0x7ff8a4a01603 
                16 ??                                                                                            0x7ff8a49ffa15 
                17 EXPLORERFRAME!DllGetClassObject                                                               0x7ff8a4a3d680 
                18 ??                                                                                            0x7ff8a49f873d 
                19 ??                                                                                            0x7ff8a49f8551 
                20 DefSubclassProc                                                                               0x7ff8bc959aba 
                21 DSA_Create                                                                                    0x7ff8bc9598b7 
                22 USER32!CallWindowProcW                                                                        0x7ff8d979e7e8 
                23 USER32!DispatchMessageW                                                                       0x7ff8d979e229 
                24 USER32!IsDialogMessageW                                                                       0x7ff8d979bfe0 
                25 USER32!DialogBoxIndirectParamAorW                                                             0x7ff8d97bd8f6 
                26 USER32!DialogBoxIndirectParamAorW                                                             0x7ff8d97bd5a1 
                27 USER32!DialogBoxIndirectParamAorW                                                             0x7ff8d97bd452 
                28 USER32!DialogBoxIndirectParamW                                                                0x7ff8d97bd3e8 
                29 DllCanUnloadNow                                                                               0x7ff8d8c4617e 
                30 GetFileTitleW                                                                                 0x7ff8d8c23064 
                31 QWindowsNativeFileDialogBase::doExec                      qwindowsdialoghelpers.cpp      962  0x1e8480d9     
                32 QWindowsNativeDialogBase::exec                            qwindowsdialoghelpers.cpp      183  0x1e937a97     
                33 QWindowsDialogHelperBase<QPlatformFileDialogHelper>::exec qwindowsdialoghelpers.cpp      394  0x1e937a97     
                34 QDialog::exec                                             qdialog.cpp                    553  0x67e6c699     
                35 QFileDialog::getSaveFileUrl                               qfiledialog.cpp                2434 0x67e7efa6     
                36 QFileDialog::getSaveFileName                              qfiledialog.cpp                2381 0x67e7f16b     
                37 MainWindow::getDestination                                mainwindow.cpp                 288  0x4048ef       
                38 MainWindow::qt_static_metacall                            moc_mainwindow.cpp             100  0x407be7       
                39 QMetaObject::activate                                     qobject.cpp                    3778 0x1480c86      
                40 QMetaObject::activate                                     qobject.cpp                    3631 0x1480fa4      
                41 QAbstractButton::clicked                                  moc_qabstractbutton.cpp        312  0x67d70117     
                42 QAbstractButtonPrivate::emitClicked                       qabstractbutton.cpp            414  0x67d70332     
                43 QAbstractButtonPrivate::click                             qabstractbutton.cpp            407  0x67d718d0     
                44 QAbstractButton::mouseReleaseEvent                        qabstractbutton.cpp            1011 0x67d71b71     
                45 QWidget::event                                            qwidget.cpp                    8888 0x67cc9f42     
                46 QAbstractButton::event                                    qabstractbutton.cpp            968  0x67d72d2c     
                47 QPushButton::event                                        qpushbutton.cpp                684  0x67e013ec     
                48 QApplicationPrivate::notify_helper                        qapplication.cpp               3752 0x67c8818e     
                49 QApplication::notify                                      qapplication.cpp               3213 0x67c8f532     
                50 QCoreApplication::notifyInternal2                         qcoreapplication.cpp           1061 0x14570a6      
                51 QCoreApplication::sendSpontaneousEvent                    qcoreapplication.cpp           1463 0x14572ec      
                52 QApplicationPrivate::sendMouseEvent                       qapplication.cpp               2699 0x67c8e8d6     
                53 QWidgetWindow::handleMouseEvent                           qwidgetwindow.cpp              661  0x67cdf5f2     
                54 QWidgetWindow::event                                      qwidgetwindow.cpp              281  0x67ce1a69     
                55 QApplicationPrivate::notify_helper                        qapplication.cpp               3752 0x67c8818e     
                56 QApplication::notify                                      qapplication.cpp               3109 0x67c8f253     
                57 QCoreApplication::notifyInternal2                         qcoreapplication.cpp           1061 0x14570a6      
                58 QCoreApplication::sendSpontaneousEvent                    qcoreapplication.cpp           1463 0x14572ec      
                59 QGuiApplicationPrivate::processMouseEvent                 qguiapplication.cpp            2102 0xb31ed65      
                60 QGuiApplicationPrivate::processWindowSystemEvent          qguiapplication.cpp            1837 0xb3201da      
                61 QWindowSystemInterface::sendWindowSystemEvents            qwindowsysteminterface.cpp     1068 0xb303959      
                62 QWindowsGuiEventDispatcher::sendPostedEvents              qwindowsguieventdispatcher.cpp 82   0x1e886ff9     
                63 qt_internal_proc                                          qeventdispatcher_win.cpp       245  0x14abb5f      
                64 USER32!CallWindowProcW                                                                        0x7ff8d979e7e8 
                65 USER32!DispatchMessageW                                                                       0x7ff8d979e229 
                66 QEventDispatcherWin32::processEvents                      qeventdispatcher_win.cpp       639  0x14ab2b9      
                67 QWindowsGuiEventDispatcher::processEvents                 qwindowsguieventdispatcher.cpp 74   0x1e886fd7     
                68 QEventLoop::processEvents                                 qeventloop.cpp                 138  0x14557c7      
                69 QEventLoop::exec                                          qeventloop.cpp                 225  0x1455be5      
                70 QCoreApplication::exec                                    qcoreapplication.cpp           1364 0x145e86e      
                71 QGuiApplication::exec                                     qguiapplication.cpp            1779 0xb315d9d      
                72 QApplication::exec                                        qapplication.cpp               2909 0x67c88070     
                73 qMain                                                     main.cpp                       10   0x4015c3       
                74 WinMain                                                   qtmain_win.cpp                 104  0x409cd2       
                75 __tmainCRTStartup                                                                             0x4013c7       
                76 WinMainCRTStartup                                                                             0x4014cb
                

                Sorry if formatting of backtrace is not ideal...

                Also, maybe relevant note, this issue happened on multiple machines (a friend of mine is using application that I provided via installer and reported me an issue and it fails in same manner on both of our machines).
                Since application has been working for years (3 more precisely) before this without any issues, my guess would be that some kind of Windows (also using Win10) update messed something up, but can't be sure about it.

                I'm currently trying to use newer version of Qt (one I was using is fairly old, 5.12.0) hoping that one with more recent date would include some kind of fix for this, but according to this problem report I don't feel so confident about it. :)

                Posting this in case it helps someone else.

                J 1 Reply Last reply 23 Feb 2023, 06:59
                0
                • C crackysk
                  22 Feb 2023, 21:47

                  I'm having similar issue as @BogdanPopa mentioned above.
                  Using QFileDialog::getSaveFileName instead of Open, but same concept...
                  Also, initial backtrace looked similar and contained avast detail, but managed to get past it and get a complete backtrace that has more sense...

                  1  ntdll!RtlCompareMemoryUlong                                                                   0x7ff8dab71aa0 
                  2  ntdll!RtlAllocateHeap                                                                         0x7ff8daafdd00 
                  3  ntdll!RtlAllocateHeap                                                                         0x7ff8daafb44d 
                  4  ntdll!RtlRegisterSecureMemoryCacheCallback                                                    0x7ff8dabc8c38 
                  5  ntdll!RtlAllocateHeap                                                                         0x7ff8daafd255 
                  6  ntdll!RtlAllocateHeap                                                                         0x7ff8daafb44d 
                  7  Windows.Storage!CFreeThreadedItemContainer_CreateInstance                                     0x7ff8d635ba26 
                  8  Windows.Storage!CFreeThreadedItemContainer_CreateInstance                                     0x7ff8d635b4be 
                  9  Windows.Storage!CCachedShellItem_CreateInstance                                               0x7ff8d635a3d2 
                  10 Windows.Storage!ILFindLastID                                                                  0x7ff8d636fc65 
                  11 Windows.Storage!SHCreateShellItemArrayFromIDLists                                             0x7ff8d640323f 
                  12 Windows.Storage!SHChangeNotification_Lock                                                     0x7ff8d6414537 
                  13 EXPLORERFRAME!DllGetClassObject                                                               0x7ff8a4a08a46 
                  14 EXPLORERFRAME!DllCanUnloadNow                                                                 0x7ff8a4a7d52a 
                  15 ??                                                                                            0x7ff8a4a01603 
                  16 ??                                                                                            0x7ff8a49ffa15 
                  17 EXPLORERFRAME!DllGetClassObject                                                               0x7ff8a4a3d680 
                  18 ??                                                                                            0x7ff8a49f873d 
                  19 ??                                                                                            0x7ff8a49f8551 
                  20 DefSubclassProc                                                                               0x7ff8bc959aba 
                  21 DSA_Create                                                                                    0x7ff8bc9598b7 
                  22 USER32!CallWindowProcW                                                                        0x7ff8d979e7e8 
                  23 USER32!DispatchMessageW                                                                       0x7ff8d979e229 
                  24 USER32!IsDialogMessageW                                                                       0x7ff8d979bfe0 
                  25 USER32!DialogBoxIndirectParamAorW                                                             0x7ff8d97bd8f6 
                  26 USER32!DialogBoxIndirectParamAorW                                                             0x7ff8d97bd5a1 
                  27 USER32!DialogBoxIndirectParamAorW                                                             0x7ff8d97bd452 
                  28 USER32!DialogBoxIndirectParamW                                                                0x7ff8d97bd3e8 
                  29 DllCanUnloadNow                                                                               0x7ff8d8c4617e 
                  30 GetFileTitleW                                                                                 0x7ff8d8c23064 
                  31 QWindowsNativeFileDialogBase::doExec                      qwindowsdialoghelpers.cpp      962  0x1e8480d9     
                  32 QWindowsNativeDialogBase::exec                            qwindowsdialoghelpers.cpp      183  0x1e937a97     
                  33 QWindowsDialogHelperBase<QPlatformFileDialogHelper>::exec qwindowsdialoghelpers.cpp      394  0x1e937a97     
                  34 QDialog::exec                                             qdialog.cpp                    553  0x67e6c699     
                  35 QFileDialog::getSaveFileUrl                               qfiledialog.cpp                2434 0x67e7efa6     
                  36 QFileDialog::getSaveFileName                              qfiledialog.cpp                2381 0x67e7f16b     
                  37 MainWindow::getDestination                                mainwindow.cpp                 288  0x4048ef       
                  38 MainWindow::qt_static_metacall                            moc_mainwindow.cpp             100  0x407be7       
                  39 QMetaObject::activate                                     qobject.cpp                    3778 0x1480c86      
                  40 QMetaObject::activate                                     qobject.cpp                    3631 0x1480fa4      
                  41 QAbstractButton::clicked                                  moc_qabstractbutton.cpp        312  0x67d70117     
                  42 QAbstractButtonPrivate::emitClicked                       qabstractbutton.cpp            414  0x67d70332     
                  43 QAbstractButtonPrivate::click                             qabstractbutton.cpp            407  0x67d718d0     
                  44 QAbstractButton::mouseReleaseEvent                        qabstractbutton.cpp            1011 0x67d71b71     
                  45 QWidget::event                                            qwidget.cpp                    8888 0x67cc9f42     
                  46 QAbstractButton::event                                    qabstractbutton.cpp            968  0x67d72d2c     
                  47 QPushButton::event                                        qpushbutton.cpp                684  0x67e013ec     
                  48 QApplicationPrivate::notify_helper                        qapplication.cpp               3752 0x67c8818e     
                  49 QApplication::notify                                      qapplication.cpp               3213 0x67c8f532     
                  50 QCoreApplication::notifyInternal2                         qcoreapplication.cpp           1061 0x14570a6      
                  51 QCoreApplication::sendSpontaneousEvent                    qcoreapplication.cpp           1463 0x14572ec      
                  52 QApplicationPrivate::sendMouseEvent                       qapplication.cpp               2699 0x67c8e8d6     
                  53 QWidgetWindow::handleMouseEvent                           qwidgetwindow.cpp              661  0x67cdf5f2     
                  54 QWidgetWindow::event                                      qwidgetwindow.cpp              281  0x67ce1a69     
                  55 QApplicationPrivate::notify_helper                        qapplication.cpp               3752 0x67c8818e     
                  56 QApplication::notify                                      qapplication.cpp               3109 0x67c8f253     
                  57 QCoreApplication::notifyInternal2                         qcoreapplication.cpp           1061 0x14570a6      
                  58 QCoreApplication::sendSpontaneousEvent                    qcoreapplication.cpp           1463 0x14572ec      
                  59 QGuiApplicationPrivate::processMouseEvent                 qguiapplication.cpp            2102 0xb31ed65      
                  60 QGuiApplicationPrivate::processWindowSystemEvent          qguiapplication.cpp            1837 0xb3201da      
                  61 QWindowSystemInterface::sendWindowSystemEvents            qwindowsysteminterface.cpp     1068 0xb303959      
                  62 QWindowsGuiEventDispatcher::sendPostedEvents              qwindowsguieventdispatcher.cpp 82   0x1e886ff9     
                  63 qt_internal_proc                                          qeventdispatcher_win.cpp       245  0x14abb5f      
                  64 USER32!CallWindowProcW                                                                        0x7ff8d979e7e8 
                  65 USER32!DispatchMessageW                                                                       0x7ff8d979e229 
                  66 QEventDispatcherWin32::processEvents                      qeventdispatcher_win.cpp       639  0x14ab2b9      
                  67 QWindowsGuiEventDispatcher::processEvents                 qwindowsguieventdispatcher.cpp 74   0x1e886fd7     
                  68 QEventLoop::processEvents                                 qeventloop.cpp                 138  0x14557c7      
                  69 QEventLoop::exec                                          qeventloop.cpp                 225  0x1455be5      
                  70 QCoreApplication::exec                                    qcoreapplication.cpp           1364 0x145e86e      
                  71 QGuiApplication::exec                                     qguiapplication.cpp            1779 0xb315d9d      
                  72 QApplication::exec                                        qapplication.cpp               2909 0x67c88070     
                  73 qMain                                                     main.cpp                       10   0x4015c3       
                  74 WinMain                                                   qtmain_win.cpp                 104  0x409cd2       
                  75 __tmainCRTStartup                                                                             0x4013c7       
                  76 WinMainCRTStartup                                                                             0x4014cb
                  

                  Sorry if formatting of backtrace is not ideal...

                  Also, maybe relevant note, this issue happened on multiple machines (a friend of mine is using application that I provided via installer and reported me an issue and it fails in same manner on both of our machines).
                  Since application has been working for years (3 more precisely) before this without any issues, my guess would be that some kind of Windows (also using Win10) update messed something up, but can't be sure about it.

                  I'm currently trying to use newer version of Qt (one I was using is fairly old, 5.12.0) hoping that one with more recent date would include some kind of fix for this, but according to this problem report I don't feel so confident about it. :)

                  Posting this in case it helps someone else.

                  J Offline
                  J Offline
                  JonB
                  wrote on 23 Feb 2023, 06:59 last edited by
                  #14

                  @crackysk said in QFileDialog::getOpenFileName causing program to crash:

                  Since application has been working for years (3 more precisely) before this without any issues, my guess would be that some kind of Windows (also using Win10) update messed something up, but can't be sure about it.

                  It is highly likely this is the case, sadly. I don't know what you can do about it (sometimes it's possible the next patch/update corrects an issue), but you might verify:

                  • I think it's clear the error comes when using the native Windows Save File dialog. Try passing QFileDialog::DontUseNativeDialog? But I'm not sure that works with getSaveFileName(), you may also have to try...
                  • ... Use a QFileDialog instance and setAcceptMode(QFileDialog::AcceptSave) to try your own code instead of the inbuilt static QFileDialog::getSaveFileName().

                  At least you will know what is required to reproduce the issue.

                  C 1 Reply Last reply 23 Feb 2023, 20:52
                  0
                  • J JonB
                    23 Feb 2023, 06:59

                    @crackysk said in QFileDialog::getOpenFileName causing program to crash:

                    Since application has been working for years (3 more precisely) before this without any issues, my guess would be that some kind of Windows (also using Win10) update messed something up, but can't be sure about it.

                    It is highly likely this is the case, sadly. I don't know what you can do about it (sometimes it's possible the next patch/update corrects an issue), but you might verify:

                    • I think it's clear the error comes when using the native Windows Save File dialog. Try passing QFileDialog::DontUseNativeDialog? But I'm not sure that works with getSaveFileName(), you may also have to try...
                    • ... Use a QFileDialog instance and setAcceptMode(QFileDialog::AcceptSave) to try your own code instead of the inbuilt static QFileDialog::getSaveFileName().

                    At least you will know what is required to reproduce the issue.

                    C Offline
                    C Offline
                    crackysk
                    wrote on 23 Feb 2023, 20:52 last edited by
                    #15

                    @JonB
                    I've tried first option before posting yesterday, but forgot to mention it (knew I would forget something).
                    Today I tried the approach with using QFileDialog instance and still have same issue.

                    One interesting thing is that with QFileDialog::DontUseNativeDialog set to false application works "slightly better". Let me try to elaborate:

                    • When set to false, Windows dialog opens fully, shows a content of starting location folder, but then freezes and runs send problem report mechanism
                    • When set to true, something I believe should be Qt dialog opens, but dialog is fully white without any useful information and instantly runs send problem report mechanism

                    Will try to play further with it and see if I can make it work somehow.
                    Thank you for your replies and time.

                    1 Reply Last reply
                    0
                    • L Offline
                      L Offline
                      LaCucaracha
                      wrote on 24 Feb 2023, 16:08 last edited by
                      #16

                      I've had the same issue in the last few days and managed to get around it.

                      I've had the same backtrace as shown above. On an app that worked for years. Qt 5.9 and now 5.15. Windows 10.

                      I don't use a QFileDialog but a QFileSystemModel set into a QTreeView.
                      When there is nothing to display, there is no crash (TreeView hidden, Model not set or Rootpath and Filters set to display an empty location).

                      My solution was to remove the icons from the display by overriding the function data() of QFileSystemModel to ignore the Qt::DecorationRole :

                      QVariant MyCustomFileModel::data(const QModelIndex& index, int role) const
                      {
                          if (role == Qt::DecorationRole)
                              return QVariant();
                          else
                              return QFileSystemModel::data(index, role);
                      }
                      

                      No icons. But it works.

                      Digging further, i made my own QFileIconProvider to give to the model.
                      The function icon is the issue.

                      QIcon QFileIconProvider::icon(const QFileInfo &info) const
                      

                      If i override it to return QIcon() it works fine, with icons. They might be different from what they were before and there might be some missing ones but i'm not sure. Probably has to do with the style of the application. (No custom style applied here)

                      For the next step, looking into QFileIconProviderPrivate, QGuiApplicationPrivate and QPlatformTheme might be a bit too much for my skills.

                      Also, the options QFileIconProvider::DontUseCustomDirectoryIcons and all of the QFileSystemModel options (DontWatchForChanges, DontResolveSymlinks, DontUseCustomDirectoryIcons) do not change anything.

                      C 1 Reply Last reply 26 Feb 2023, 11:59
                      1
                      • L LaCucaracha
                        24 Feb 2023, 16:08

                        I've had the same issue in the last few days and managed to get around it.

                        I've had the same backtrace as shown above. On an app that worked for years. Qt 5.9 and now 5.15. Windows 10.

                        I don't use a QFileDialog but a QFileSystemModel set into a QTreeView.
                        When there is nothing to display, there is no crash (TreeView hidden, Model not set or Rootpath and Filters set to display an empty location).

                        My solution was to remove the icons from the display by overriding the function data() of QFileSystemModel to ignore the Qt::DecorationRole :

                        QVariant MyCustomFileModel::data(const QModelIndex& index, int role) const
                        {
                            if (role == Qt::DecorationRole)
                                return QVariant();
                            else
                                return QFileSystemModel::data(index, role);
                        }
                        

                        No icons. But it works.

                        Digging further, i made my own QFileIconProvider to give to the model.
                        The function icon is the issue.

                        QIcon QFileIconProvider::icon(const QFileInfo &info) const
                        

                        If i override it to return QIcon() it works fine, with icons. They might be different from what they were before and there might be some missing ones but i'm not sure. Probably has to do with the style of the application. (No custom style applied here)

                        For the next step, looking into QFileIconProviderPrivate, QGuiApplicationPrivate and QPlatformTheme might be a bit too much for my skills.

                        Also, the options QFileIconProvider::DontUseCustomDirectoryIcons and all of the QFileSystemModel options (DontWatchForChanges, DontResolveSymlinks, DontUseCustomDirectoryIcons) do not change anything.

                        C Offline
                        C Offline
                        crackysk
                        wrote on 26 Feb 2023, 11:59 last edited by
                        #17

                        @LaCucaracha

                        Thank you for reply. I even tried QFileIconProvider::DontUseCustomDirectoryIcons at some point, but didn't cross my mind that's not doing anything useful.

                        I tried providing icon provider directly to static QFileDialog for save/open file that I was using, but it made no difference. Also, creating custom FileIconProvider and providing it to instance of QFileDialog created in app made no difference (also creating custom QFileDialog class).
                        So, I basically moved to same thing as you did. I've written my own dialog that's doing same thing as static one I was using before.
                        Now, I have treeView and listView next to each other, both of them provided with different QFileSystemModel (different when it comes to filter) and provided custom QFileIconProvider class that has icon() overridden. And really, crashes are gone!

                        Honestly, I don't even mind having same file icon for each file type. For purposes I need it for, this is more than enough. But, if someone needs it, probably can even do similar thing like you did for a role and look for a specific QFileInfo that makes a mess and for all others use just default constructor for QIcon as you did.

                        All that's left to do is handling cosmetics in order to make this new QDialog as close as possible to the one.

                        1 Reply Last reply
                        0
                        • V Offline
                          V Offline
                          Vsevolod7
                          wrote on 3 Mar 2023, 19:44 last edited by
                          #18

                          Same problem.

                          1 Reply Last reply
                          0
                          • ? Offline
                            ? Offline
                            A Former User
                            wrote on 4 Mar 2023, 09:30 last edited by
                            #19

                            I copy your codes and run it on win11 successfully. I used Qt5.13 and the compiler 'MingGW 64bit'. Add I tried the compiler 'MSVC2015', it is all right too. I think our developing environment are similar to each other.

                            1 Reply Last reply
                            0
                            • A Offline
                              A Offline
                              az1699
                              wrote on 14 Mar 2023, 10:52 last edited by az1699
                              #20

                              Same issue here. I've a test application made few months ago that always worked. I fixed by working around using DontUseNativeDialog.

                              If I run the same application, same build, on windows sand box it works perfectlly. Dont know why, windows sand box should have the same windows system update as my system

                              1 Reply Last reply
                              0
                              • A Offline
                                A Offline
                                az1699
                                wrote on 14 Mar 2023, 11:46 last edited by
                                #21

                                I also tried this, don't why but after istancing QFileDialog with QFileDialog::DontUseNativeDialog I can start using QFileDialog in the previous way. I tested this simple example and works.

                                    static bool first_run = true;
                                    if (first_run) {
                                        CmdOpenFile(QFileDialog::getOpenFileName(0, "Open some file", QString(), QObject::tr("All files (*.*)"), nullptr, QFileDialog::DontUseNativeDialog));
                                        first_run = false;
                                    } else {
                                        CmdOpenFile(QFileDialog::getOpenFileName(0, "Open some file", QString(), QObject::tr("All files (*.*)")));
                                    }
                                
                                1 Reply Last reply
                                0
                                • V Offline
                                  V Offline
                                  Violet Giraffe
                                  wrote on 14 Mar 2023, 12:55 last edited by Violet Giraffe
                                  #22

                                  I can't speak for every case in particular, but these symptoms are very typical for a misbehaving shell / Explorer extension, and not related to Qt, most likely.

                                  I've seen some projects (for example - Firefox) maintain a list of known faulty DLLs and use LoadLibrary hooks to prevent those DLLs from loading.

                                  1 Reply Last reply
                                  2
                                  • S Offline
                                    S Offline
                                    sir_clive
                                    wrote on 15 Mar 2023, 13:21 last edited by sir_clive
                                    #23

                                    I'd like to add my experience with this issue.

                                    I pulled my hair out over a very similar (probably the same?) problem lately, and it turned out that AVAST and AVG (practically the same product) are causing this problem in my case. These programs must be uninstalled (not deactivated, but completely uninstalled) for my program to start working again.

                                    My program was working on multiple versions of Windows for years already, with no issues whatsoever. The problems started in February this year (2023), and affect every single "file dialog" instance my program tries to open.

                                    The tip with not using native dialog did not help in my case. Also VMWare based Windows installations are not affected, only the "bare metal" ones. Also, 5.x and 6.x QT versions are both crashing if AVAST or AVG are installed.

                                    I'm surprised not more QT programs are affected, this is the best thread I found so far.

                                    A 1 Reply Last reply 15 Mar 2023, 14:32
                                    0
                                    • S sir_clive
                                      15 Mar 2023, 13:21

                                      I'd like to add my experience with this issue.

                                      I pulled my hair out over a very similar (probably the same?) problem lately, and it turned out that AVAST and AVG (practically the same product) are causing this problem in my case. These programs must be uninstalled (not deactivated, but completely uninstalled) for my program to start working again.

                                      My program was working on multiple versions of Windows for years already, with no issues whatsoever. The problems started in February this year (2023), and affect every single "file dialog" instance my program tries to open.

                                      The tip with not using native dialog did not help in my case. Also VMWare based Windows installations are not affected, only the "bare metal" ones. Also, 5.x and 6.x QT versions are both crashing if AVAST or AVG are installed.

                                      I'm surprised not more QT programs are affected, this is the best thread I found so far.

                                      A Offline
                                      A Offline
                                      az1699
                                      wrote on 15 Mar 2023, 14:32 last edited by
                                      #24

                                      @sir_clive I've Avast antivurs on my computer, i tested in an other without avast and works :(

                                      So maybe reporting this issue the could fix it

                                      1 Reply Last reply
                                      0
                                      • B bdieterm referenced this topic on 29 May 2023, 16:47
                                      • V Offline
                                        V Offline
                                        VirtualFloat
                                        wrote on 6 Mar 2025, 07:16 last edited by
                                        #25

                                        Running into the same issue here on some corporate windows 11 machines. So in 2025 it is still causing issues.

                                        V 1 Reply Last reply 6 Mar 2025, 18:48
                                        0
                                        • V VirtualFloat
                                          6 Mar 2025, 07:16

                                          Running into the same issue here on some corporate windows 11 machines. So in 2025 it is still causing issues.

                                          V Offline
                                          V Offline
                                          Violet Giraffe
                                          wrote on 6 Mar 2025, 18:48 last edited by
                                          #26

                                          @VirtualFloat
                                          Does the crash occur in a Qt .dll, or inside a foreign dll injected by some security software? The latter is, unfortunately, not uncommon.

                                          1 Reply Last reply
                                          0

                                          • Login

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • Users
                                          • Groups
                                          • Search
                                          • Get Qt Extensions
                                          • Unsolved