-
Bug
-
Resolution: Fixed
-
P2: Important
-
6.6.0
-
None
-
Windows 11 2H22, MSVC 19.36.32535.0 64bit
-
-
59e21a536 (dev), f89d80c90 (6.7), d5528cdec (6.6)
QPromise::finish() hangs when QFuture::then() continuation uses a context QObject and the promise is resolved from the same thread as the context object's parent thread.
Minimal repro case:
#include <QCoreApplication> #include <QPromise> #include <QFuture> #include <QDebug> int main(int argc, char *argv[]) { QCoreApplication app(argc, argv); QObject *context = new QObject; QPromise<int> p; QFuture<int> f = p.future(); f.then(context, [](int a) { qDebug("result is %d", a); // this is never called }); p.start(); p.addResult(43); p.finish(); // this never returns return app.exec(); }
Note, if we don't pass the context parameter, it works just fine, i.e. the continuation is executed and p.finish() returns.
It also works fine, if the promise is resolved in different thread.
- duplicates
-
QTBUG-119406 QFuture::then() with context object deadlocks
-
- Closed
-
For Gerrit Dashboard: QTBUG-119103 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
520860,15 | QFuture: Don't use QFutureCallOutInterface for continuations | dev | qt/qtbase | Status: MERGED | +2 | 0 |
525172,2 | QFuture: Don't use QFutureCallOutInterface for continuations | 6.7 | qt/qtbase | Status: MERGED | +2 | 0 |
525292,2 | QFuture: Don't use QFutureCallOutInterface for continuations | 6.6 | qt/qtbase | Status: MERGED | +2 | 0 |