Details
-
Bug
-
Resolution: Done
-
P1: Critical
-
5.5.0
-
None
-
Change-Id: Iab73d02933635821b8d1ca1ff3d53e92eca85834
Description
Calling QTimer::singleShot with a 0ms interval, a functor callback and a context object in another thread can cause a crash. The following code triggers the crash when left to run for a relatively short period of time:
#include <QGuiApplication> #include <QTimer> #include <QThread> int main(int argc, char *argv[]) { QGuiApplication a(argc, argv); QThread thread; thread.start(); QObject* o = new QObject(); o->moveToThread(&thread); QTimer t; t.setInterval(0); QObject::connect(&t, &QTimer::timeout, [&]() { QTimer::singleShot(0, o, []() {}); }); t.start(); return a.exec(); }