summaryrefslogtreecommitdiffstats
path: root/src/corelib/concurrent/qfutureinterface.h
diff options
context:
space:
mode:
authorMorten Sørvig <msorvig@trolltech.com>2009-05-05 12:29:44 (GMT)
committerMorten Sørvig <msorvig@trolltech.com>2009-05-05 12:29:44 (GMT)
commit8be2b24705da4bce99b3a3d588aedcfe2eb3f886 (patch)
tree76dd284f996bcade6ddb04d26cdf44baac7a561c /src/corelib/concurrent/qfutureinterface.h
parentc03a4544fa3c1400fef3f1ad847bc3c65e660de7 (diff)
downloadQt-8be2b24705da4bce99b3a3d588aedcfe2eb3f886.zip
Qt-8be2b24705da4bce99b3a3d588aedcfe2eb3f886.tar.gz
Qt-8be2b24705da4bce99b3a3d588aedcfe2eb3f886.tar.bz2
Fix memory leak in QFuture
The held results were not cleared by QFutureInterface::operator=(QFutureInterface) Add call to resultStore().clear(), similar to the destructor. This needs to be done in the header since we know the template type here. Task-number: 252208 Reviewed-by: brad
Diffstat (limited to 'src/corelib/concurrent/qfutureinterface.h')
-rw-r--r--src/corelib/concurrent/qfutureinterface.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/corelib/concurrent/qfutureinterface.h b/src/corelib/concurrent/qfutureinterface.h
index 85d03c9..345bebe 100644
--- a/src/corelib/concurrent/qfutureinterface.h
+++ b/src/corelib/concurrent/qfutureinterface.h
@@ -165,6 +165,8 @@ public:
QFutureInterface &operator=(const QFutureInterface &other)
{
+ if (referenceCountIsOne())
+ resultStore().clear();
QFutureInterfaceBase::operator=(other);
return *this;
}