Details
-
Bug
-
Resolution: Done
-
P3: Somewhat important
-
5.10.0
-
None
-
* Manjaro Linux, Kernel Version 4.14.9, x64
* gcc-Version 7.2.1
* Qt 5.10.0 gcc_64
* Qt 5.10.0 from distribution
-
891b60bbc84ddde077072df3426539c716d47459 (qt/qtbase/dev) 5a4b275a201bfc653a99e8b6ab546573553b79ad (qt/qtbase/5.15)
Description
As of the documentation, QThreadPool::start is threadsafe. However, when using it from a destructor of a autodeleted QRunnable subclass, it leads to a (guaranteed) deadlock. Sample code:
class TestRunnable : public QRunnable { public: TestRunnable() { setAutoDelete(true); } ~TestRunnable() { QThreadPool::globalInstance()->start(new OtherRunnable()); } // ... }
I attached a test source file which provokes such a situation. By checking the console output, you can see that QThreadPool::start() never returns.