summaryrefslogtreecommitdiffstats
path: root/src/corelib/thread/qpromise.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib/thread/qpromise.h')
-rw-r--r--src/corelib/thread/qpromise.h8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/corelib/thread/qpromise.h b/src/corelib/thread/qpromise.h
index a970f40d12..f62a2a54e3 100644
--- a/src/corelib/thread/qpromise.h
+++ b/src/corelib/thread/qpromise.h
@@ -66,12 +66,16 @@ public:
{
const int state = d.loadState();
// If QFutureInterface has no state, there is nothing to be done
- if (state == static_cast<int>(QFutureInterfaceBase::State::NoState))
+ if (state == static_cast<int>(QFutureInterfaceBase::State::NoState)) {
+ d.cleanContinuation();
return;
+ }
// Otherwise, if computation is not finished at this point, cancel
// potential waits
- if (!(state & QFutureInterfaceBase::State::Finished))
+ if (!(state & QFutureInterfaceBase::State::Finished)) {
d.cancelAndFinish(); // cancel and finalize the state
+ d.cleanContinuation();
+ }
}
// Core QPromise APIs