Details
-
Bug
-
Resolution: Invalid
-
Not Evaluated
-
None
-
5.10.0
-
None
Description
Static build, Qt 5.10, VS15.5.5, Win10.
In user code I have a global variable:
QTranslator myTranslator;
It is initialized earlier than (corelib/kernel/qcoreapplication.cpp):
QBasicAtomicPointer<QThread> QCoreApplicationPrivate::theMainThread = Q_BASIC_ATOMIC_INITIALIZER(0);
So, inside of translator there's initialization of QCoreApplicationPrivate::theMainThread that is overwritten later with 0, so I see an assertion Q_ASSERT(theMainThread.load() != 0);
A workaround (fix?) is simple for my code - remove global translator. But similar things probably can be encountered with other global qt vars in user code, so qt-side fix will be useful.
An obvious solution for me is to put that theMainThread variable completely inside the static member function to prevent that incorrect init from CRT due to ordering issues.