-
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.