summaryrefslogtreecommitdiffstats
path: root/src/corelib/concurrent/qfutureinterface.cpp
diff options
context:
space:
mode:
authorOrgad Shaneh <orgad.shaneh@audiocodes.com>2012-11-04 19:21:31 (GMT)
committerThe Qt Project <gerrit-noreply@qt-project.org>2012-11-08 14:11:56 (GMT)
commit17bea1689abc695d88f13cd15f73b0a59fcffdff (patch)
tree3686d3b4face64fb47fdb643a8bb73c887481101 /src/corelib/concurrent/qfutureinterface.cpp
parenta4b5cd2893a5eef09d615340ae899f785de84858 (diff)
downloadQt-17bea1689abc695d88f13cd15f73b0a59fcffdff.zip
Qt-17bea1689abc695d88f13cd15f73b0a59fcffdff.tar.gz
Qt-17bea1689abc695d88f13cd15f73b0a59fcffdff.tar.bz2
QtConcurrent: Fix for leak in QFuture
To avoid leaking when converting a QFuture<T> to a QFuture<void> we need to have a separate ref. counter for QFuture<T>. When the last QFuture<T> goes out of scope, we need to clean out the result data. backported from qt/qtbase commit 731ba8ed08f80644b403556638c7f6229e678ebe Original commit by Christian Strømme Task-number: QTBUG-27224 Change-Id: I0c6b525cf241b5c559a1bab4e0066cd4de556ea8 Reviewed-by: Christian Stromme <christian.stromme@digia.com>
Diffstat (limited to 'src/corelib/concurrent/qfutureinterface.cpp')
-rw-r--r--src/corelib/concurrent/qfutureinterface.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/corelib/concurrent/qfutureinterface.cpp b/src/corelib/concurrent/qfutureinterface.cpp
index 9668e5d..6853a1a 100644
--- a/src/corelib/concurrent/qfutureinterface.cpp
+++ b/src/corelib/concurrent/qfutureinterface.cpp
@@ -419,6 +419,16 @@ bool QFutureInterfaceBase::referenceCountIsOne() const
return d->refCount == 1;
}
+bool QFutureInterfaceBase::refT() const
+{
+ return d->refCount.refT();
+}
+
+bool QFutureInterfaceBase::derefT() const
+{
+ return d->refCount.derefT();
+}
+
QFutureInterfaceBasePrivate::QFutureInterfaceBasePrivate(QFutureInterfaceBase::State initialState)
: refCount(1), m_progressValue(0), m_progressMinimum(0), m_progressMaximum(0),
state(initialState), pendingResults(0),