Details
-
Type:
Bug
-
Status: Closed
-
Priority:
P2: Important
-
Resolution: Invalid
-
Affects Version/s: 6.2.0 RC2, 6.3
-
Fix Version/s: None
-
Component/s: Core: Threads
-
Labels:None
-
Platform/s:
Description
Running a program that creates a thread and then calls start() and wait() in a loop causes the following error on Linux:
terminate called after throwing an instance of 'std::future_error' what(): std::future_error: No associated state
Here is the program:
#include <QCoreApplication> #include <QThread> #include <QTimer> static void startAndWaitForever() { QThread *thread = QThread::create([](){ }); for (;;) { thread->start(); Q_ASSERT(thread->wait()); } }; int main(int argc, char **argv) { QCoreApplication app(argc, argv); QTimer::singleShot(0, startAndWaitForever); return app.exec(); }