Details
-
Bug
-
Resolution: Done
-
P1: Critical
-
6.2.4, 6.3.0
-
Windows 10 Pro 21H2, MSVC 2019 x64
-
-
ffb9dee1b0 (qt/qtbase/dev) ffb9dee1b0 (qt/tqtc-qtbase/dev) 7b7c9c6996 (qt/qtbase/6.4) 7b7c9c6996 (qt/tqtc-qtbase/6.4) 7b7c9c6996 (qt/tqtc-qtbase/6.4.1) 7b7c9c6996 (qt/tqtc-qtbase/tqtc/qtinsight-6.4), ec5370458 (6.4), 9d36ae3f8 (dev), fbbf6f35c (dev)
Description
Steps to reproduce
Run the attached project and close the window each time it appears.
#include <QGuiApplication> #include <QQmlApplicationEngine> int main() { for (int i = 1; i <= 3; ++i) { qDebug() << "Launching Qt app, repetition" << i; int argc = 1; QByteArray argv0("Window"); QVector<char*> argv{argv0.data()}; QGuiApplication app(argc, argv.data()); QQmlApplicationEngine engine; qDebug("About to load main.qml..."); engine.load(QUrl("qrc:/main.qml")); qDebug("...main.qml loaded"); app.exec(); qDebug("Window closed"); } }
Result
Qt 6.3.0:
Launching Qt app, repetition 1 About to load main.qml... ...main.qml loaded Window closed Launching Qt app, repetition 2 About to load main.qml... 11:45:27: D:\Test\build-ReloadableApp-Desktop_Qt_6_3_0_MSVC2019_64bit-Debug\debug\ReloadableApp.exe crashed.
Qt 5.15.2:
Launching Qt app, repetition 1 About to load main.qml... ...main.qml loaded Window closed Launching Qt app, repetition 2 About to load main.qml... ...main.qml loaded Window closed Launching Qt app, repetition 3 About to load main.qml... ...main.qml loaded Window closed
Use-case
Unloading and reloading QApplication is typically done when Qt is used to implement a plugin for a larger non-Qt application
Notes
- The crash does not occur if the QGuiApplication constructor is moved outside the for-loop (so it is never destroyed in the loop). However, this is not always feasible.
- QWidget-based GUIs do not crash.
Attachments
For Gerrit Dashboard: QTBUG-103611 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
415868,1 | Fix regression crash in QQmlApplicationEngine | dev | qt/qtbase | Status: ABANDONED | -1 | 0 |
416169,1 | Replace OleInitialize() by Windows::Foundation::Initialize() | dev | qt/qtbase | Status: ABANDONED | -1 | 0 |
416206,1 | Initialize the Windows Runtime API by ReInitialize() | dev | qt/qtbase | Status: ABANDONED | -1 | 0 |
416240,1 | Ugly workaround for bug in Windows Runtime API | dev | qt/qtbase | Status: ABANDONED | +1 | 0 |
416500,25 | Proper clearing of WinRT factory cache | dev | qt/qtbase | Status: MERGED | +2 | 0 |
440800,2 | Proper clearing of WinRT factory cache | 6.4 | qt/qtbase | Status: MERGED | +2 | 0 |
440801,4 | Proper clearing of WinRT factory cache | tqtc/lts-6.2 | qt/tqtc-qtbase | Status: MERGED | +2 | 0 |
443580,5 | Proper clearing of WinRT factory cache in QWindowsTheme | dev | qt/qtbase | Status: MERGED | +2 | 0 |
445241,2 | Proper clearing of WinRT factory cache in QWindowsTheme | 6.4 | qt/qtbase | Status: MERGED | +2 | 0 |
445242,1 | Proper clearing of WinRT factory cache in QWindowsTheme | tqtc/lts-6.2 | qt/tqtc-qtbase | Status: ABANDONED | 0 | 0 |
455577,3 | Proper clearing of WinRT factory cache in QtBluetooth | dev | qt/qtconnectivity | Status: MERGED | +2 | 0 |
455622,2 | Proper clearing of WinRT factory cache in QtTextToSpeech | dev | qt/qtspeech | Status: MERGED | +2 | 0 |
455627,2 | Proper clearing of WinRT factory cache in QtMultimedia | dev | qt/qtmultimedia | Status: MERGED | +2 | 0 |
455811,2 | Proper clearing of WinRT factory cache in QtBluetooth | 6.5 | qt/qtconnectivity | Status: MERGED | +2 | 0 |
455812,2 | Proper clearing of WinRT factory cache in QtBluetooth | 6.4 | qt/qtconnectivity | Status: MERGED | +2 | 0 |
455813,2 | Proper clearing of WinRT factory cache in QtTextToSpeech | 6.5 | qt/qtspeech | Status: MERGED | +2 | 0 |
455814,2 | Proper clearing of WinRT factory cache in QtTextToSpeech | 6.4 | qt/qtspeech | Status: MERGED | +2 | 0 |
455815,2 | Proper clearing of WinRT factory cache in QtMultimedia | 6.5 | qt/qtmultimedia | Status: MERGED | +2 | 0 |
455818,2 | Proper clearing of WinRT factory cache in QtBluetooth | tqtc/lts-6.2 | qt/tqtc-qtconnectivity | Status: MERGED | +2 | 0 |