-
Bug
-
Resolution: Unresolved
-
P3: Somewhat important
-
None
-
6.9.1
-
None
IMHO QFuture::waitForFinished should throw QPromise exception even if it was canceled.
See the attached example for better understanding.
Mind the Q_ASSERTs in the source code, all should pass.
We should be able to set exceptions on all states but finished.
It's very useful to catch a custom canceled exception in a try/catch
block.
e.g.
class CanceledException : public QException {...} ... if (promise.isCanceled() promise.setException(CanceledException{}); else promise.addResult(result); ... try { auto res = future.takeResult(); } catch (const CanceledException &) { // handle canceled } catch (const AnotherSpeciticException &) { // AnotherSpecitic }
For Gerrit Dashboard: QTBUG-139122 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
668842,3 | WIP: Set exception if we're in cancel state | dev | qt/qtbase | Status: NEW | -2 | 0 |