Details
-
Bug
-
Resolution: Won't Do
-
P1: Critical
-
None
-
6.4.3, 6.6.2
-
None
Description
Creating a QPromise and fulfilling it in a separate thread, could result in a deadlock from the main thread. This can happen, because the continuation of the associated QFuture is run after signaling the finish state. If the QFuture exits scope and is deallocated, the QFutureInterfaceBase::runContinuation() call would read from a dangling mutex, potentially locking indefinitely.
The behavior is replicatable with Qt 6.6.2 and 6.4.3 under Debian 11 (Linux 5.10.0-26-amd64) and Debian 12 (Linux 6.1.0-18-amd64).
Attached is a small example project, replicating the bug. The program should continue printing the current timestamp, otherwise a deadlock occurred. On average, it takes less than a minute to replicate the issue.