diff options
author | Fredrik Orderud <forderud@gmail.com> | 2016-01-27 00:36:29 +0100 |
---|---|---|
committer | Fredrik Orderud <forderud@gmail.com> | 2016-01-27 09:17:05 +0000 |
commit | bb9ee3a9794b73bb16a4cb0f445fe773e6af79e2 (patch) | |
tree | 974ac4d07f5c446d0949dfef5a5413355a018993 | |
parent | 7a8395dc18a14a4ed356bd69ada5fbf9721ba5fe (diff) |
Change "argc" variable to have static lifetime.
Required, since the QApplication object contains a reference back to "argc".
The lifetime of the QApplication object exceeds "argc" on the stack. This in
turn causes QApplication to see a corrupted "argc" values later in the function.
This fixes a nasty crash during IDC-based IDL generation & DLL registration
that was only observed in release build post-build events with VS2012.
Change-Id: Ie8e404060deccadc75560748ad7071b41425cf79
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
-rw-r--r-- | src/activeqt/control/qaxserver.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/activeqt/control/qaxserver.cpp b/src/activeqt/control/qaxserver.cpp index 1703765..74b7c57 100644 --- a/src/activeqt/control/qaxserver.cpp +++ b/src/activeqt/control/qaxserver.cpp @@ -248,7 +248,7 @@ HRESULT UpdateRegistry(BOOL bRegister) // we try to create the ActiveX widgets later on... bool delete_qApp = false; if (!qApp) { - int argc = 0; + 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, 0); delete_qApp = true; } @@ -1147,7 +1147,7 @@ extern "C" HRESULT __stdcall DumpIDL(const QString &outfile, const QString &ver) // dummy application to create widgets bool delete_qApp = false; if (!qApp) { - int argc=0; + 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, 0); delete_qApp = true; } |