diff options
Diffstat (limited to 'src/corelib/concurrent/qfutureinterface.h')
-rw-r--r-- | src/corelib/concurrent/qfutureinterface.h | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/src/corelib/concurrent/qfutureinterface.h b/src/corelib/concurrent/qfutureinterface.h index 30bfbdb60e..dfe79416de 100644 --- a/src/corelib/concurrent/qfutureinterface.h +++ b/src/corelib/concurrent/qfutureinterface.h @@ -132,6 +132,8 @@ public: protected: bool referenceCountIsOne() const; + bool refT() const; + bool derefT() const; public: #ifndef QFUTURE_TEST @@ -150,13 +152,17 @@ class QFutureInterface : public QFutureInterfaceBase public: QFutureInterface(State initialState = NoState) : QFutureInterfaceBase(initialState) - { } + { + refT(); + } QFutureInterface(const QFutureInterface &other) : QFutureInterfaceBase(other) - { } + { + refT(); + } ~QFutureInterface() { - if (referenceCountIsOne()) + if (!derefT()) resultStore().clear(); } @@ -165,7 +171,8 @@ public: QFutureInterface &operator=(const QFutureInterface &other) { - if (referenceCountIsOne()) + other.refT(); + if (!derefT()) resultStore().clear(); QFutureInterfaceBase::operator=(other); return *this; |