Details
-
Bug
-
Resolution: Fixed
-
Not Evaluated
-
5.12.0
-
None
-
-
d5891036de4622e18cf4d68750610224ad201ee0
Description
Function QDateTime::toString(const QString& format) is not reentrant.
It crashes if use this function in multi-thread application, even with own instances of QDateTime.
Example:
#include <QCoreApplication> #include <thread> #include <QDateTime> void func() { QDateTime dt = QDateTime::currentDateTimeUtc(); for (int i = 0; i < 1000000; i++) QString s = dt.toString(QStringLiteral("hh:mm:ss.zzz")); } int main(int argc, char *argv[]) { QCoreApplication a(argc, argv); std::thread t1(func); std::thread t2(func); std::thread t3(func); t1.join(); t2.join(); t3.join(); return a.exec(); }