- 
    
Bug
 - 
    Resolution: Fixed
 - 
    
P2: Important
 - 
    6.2.0
 
- 
        8
 - 
        Team 1 Foundation_Sprint 46
 
I would have expected something like this to work:
QPromise<int> p;
auto f = p.future().then([](int i){ return i; }).onCanceled([]{ qDebug("canceled"); return -1; });
p.start();
f.cancel();
p.addResult(1);
p.finish();
f.result();
But it just hangs in the result() and onCanceled handler is not called.
This works however:
QPromise<int> p;
auto original = p.future();
auto f = original.then([](int i){ return i; }).onCanceled([]{ qDebug("canceled"); return -1; });
p.start();
original.cancel();
p.addResult(1);
p.finish();
f.result();
So it looks like cancel() call to the future returned by then/onCanceled/onFailed does not propagate to the original QFuture.
| For Gerrit Dashboard: QTBUG-97582 | ||||||
|---|---|---|---|---|---|---|
| # | Subject | Branch | Project | Status | CR | V | 
| 378262,20 | Update documentation of QFuture continuations | dev | qt/qtbase | Status: MERGED | +2 | 0 | 
| 380747,11 | QFuture: support cancellation of continuation chain through parent | dev | qt/qtbase | Status: MERGED | +2 | 0 | 
| 380748,4 | QFuture: extend the docs to explain how to cancel continuation chain | dev | qt/qtbase | Status: MERGED | +2 | 0 | 
| 381313,2 | Update documentation of QFuture continuations | 6.2 | qt/qtbase | Status: MERGED | +2 | 0 | 
| 383997,3 | QFuture: support cancellation of continuation chain through parent | 6.2 | qt/qtbase | Status: MERGED | +2 | 0 | 
| 383998,3 | QFuture: extend the docs to explain how to cancel continuation chain | 6.2 | qt/qtbase | Status: MERGED | +2 | 0 |