Details
-
Bug
-
Resolution: Invalid
-
P1: Critical
-
None
-
5.12
-
None
-
Qt 5.12.6, MSVC 2017, Win10 x64
Description
I have a static lib method which returns a QApplication pointer
QApplication *Testlib::createApp(int argc, char *argv[]) {
QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
return new QApplication(argc, argv);
}
But it sometimes will crash when calling the arguments() method.
int main(int argc, char *argv[]) {
QApplication *a = Testlib::createApp(argc, argv);
qDebug() << a->arguments() << argc;
return 0;
}
Exception at 0x7ffcea35a839, code: 0xe06d7363: C++ exception, flags=0x1 (execution cannot be continued) (first chance) in Qt5Cored!QVariant::QVariant
Exception at 0x7ffcea35a839, code: 0xe06d7363: C++ exception, flags=0x1 (execution cannot be continued) in Qt5Cored!QVariant::QVariant
When it not crash, it gives an empty QStringList
() 1
I met this issue with x64 build only.
If the pointer is created in main(), nothing goes wrong.
If the Testlib::createApp returns a std::unique_ptr<QApplication>, everything works too.