Details
-
Bug
-
Resolution: Done
-
P2: Important
-
6.0.1
-
None
-
-
3
-
53e4a50c6b3c7359b9afc24f30c9517abdf9561a (qt/qtbase/dev) f20f5b722fd497980e22ef6b1ca5053eac06b251 (qt/qtbase/6.2) c4012ff5f08c02840ef42216e1273b08e6bf5234 (qt/qtbase/6.1)
-
Qt6_Foundation_Sprint 38
Description
The documentation says "QFutureWatcher::isFinished() Returns true if the asynchronous computation represented by the future() has finished".
From reading this, I assume that calling watcher.isFinished() is equivalent to watcher.future().isFinished(). But it's not. The watcher only becomes finished after the control-flow has been given back to the event loop, so that the "finished event" can be consumed by the watcher. IMO, this is an important detail. And it has driven me crazy while trying to figure out why the watcher in my app isn't emitting any signals.
Please, either mention this behavior explicitly in the docs, or change the implementation so that watcher.isFinished() becomes equivalent to watcher.future().isFinished().
Steps to reproduce:
QFutureWatcher<int> watcher; QFuture<int> fut = startSomethingAsync(); watcher.setFuture(fut); watcher.waitForFinished(); bool l = fut.isFinished(); // true l = wat.future().isFinished(); // true l = wat.isFinished(); // false??