summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFredrik Orderud <fredrik.orderud@ge.com>2023-01-19 15:30:45 +0100
committerFredrik Orderud <fredrik.orderud@ge.com>2023-01-23 14:51:17 +0100
commita1b49152e7a46da955515b8d38d86b947d78bd26 (patch)
tree7aa1fa7a13c4c4db98e3bffae84acf4151bf1178
parent0e15d0ad6bba4cb700b7cd6dc7532933e7981f6f (diff)
downloadqtactiveqt-a1b49152e7a46da955515b8d38d86b947d78bd26.tar.gz
Fix invalid QApplication construction
QApplication construction with argc=0 is incorrect according to the doc. The construction pattern is furthermore causing problems in QtWebEngine, which is expecting the executable name as first command-line arguments as reported in QTBUG-110157. Fix problem by using the Microsoft-specific __argc and __argv globals. This ensures that the actual command-line arguments are used for QApplication construction. Pick-to: 6.5 Task-number: QTBUG-110158 Change-Id: Ib8e6ac7a1c24cfabfdafe8489fe8b8c4765753fd Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
-rw-r--r--src/activeqt/control/qaxserver.cpp6
-rw-r--r--src/activeqt/control/qaxserverbase.cpp3
2 files changed, 3 insertions, 6 deletions
diff --git a/src/activeqt/control/qaxserver.cpp b/src/activeqt/control/qaxserver.cpp
index d7ea1d2..aa4b951 100644
--- a/src/activeqt/control/qaxserver.cpp
+++ b/src/activeqt/control/qaxserver.cpp
@@ -438,8 +438,7 @@ HRESULT UpdateRegistry(bool bRegister, bool perUser)
// we try to create the ActiveX widgets later on...
bool delete_qApp = false;
if (!qApp) {
- static int argc = 0; // static lifetime, since it's passed as reference to QApplication, which has a lifetime exceeding the stack frame
- (void)new QApplication(argc, nullptr);
+ (void)new QApplication(__argc, __argv);
delete_qApp = true;
}
@@ -1145,8 +1144,7 @@ extern "C" HRESULT __stdcall DumpIDL(const QString &outfile, const QString &ver)
// dummy application to create widgets
bool delete_qApp = false;
if (!qApp) {
- static int argc = 0; // static lifetime, since it's passed as reference to QApplication, which has a lifetime exceeding the stack frame
- (void)new QApplication(argc, nullptr);
+ (void)new QApplication(__argc, __argv);
delete_qApp = true;
}
diff --git a/src/activeqt/control/qaxserverbase.cpp b/src/activeqt/control/qaxserverbase.cpp
index ac52583..0800cd9 100644
--- a/src/activeqt/control/qaxserverbase.cpp
+++ b/src/activeqt/control/qaxserverbase.cpp
@@ -882,8 +882,7 @@ HRESULT QClassFactory::CreateInstanceHelper(IUnknown *pUnkOuter, REFIID iid, voi
// Make sure a QApplication instance is present (inprocess case)
if (!qApp) {
qax_ownQApp = true;
- static int argc = 0; // static lifetime, since it's passed as reference to QApplication, which has a lifetime exceeding the stack frame
- new QApplication(argc, nullptr);
+ new QApplication(__argc, __argv);
}
QGuiApplication::setQuitOnLastWindowClosed(false);