summaryrefslogtreecommitdiffstats
path: root/src/corelib/concurrent
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2012-11-18 22:54:41 (GMT)
committerThe Qt Project <gerrit-noreply@qt-project.org>2012-11-19 23:27:56 (GMT)
commit8ef339ed2fed66646f458c60b2e0e7ac560dad06 (patch)
tree38db8c86f4c27e68d8855820da49b0da9cac44b9 /src/corelib/concurrent
parent94be95934fb3f0ab339fd169ef529f05f1a6707d (diff)
downloadQt-8ef339ed2fed66646f458c60b2e0e7ac560dad06.zip
Qt-8ef339ed2fed66646f458c60b2e0e7ac560dad06.tar.gz
Qt-8ef339ed2fed66646f458c60b2e0e7ac560dad06.tar.bz2
Revert "QtConcurrent: Fix for leak in QFuture"
This reverts commit 28b06b3ebae3d411c74f09fa7de52bc290c47dc3 That commit contains new symbols added in a patch release of Qt. That is not permitted. Change-Id: I1d36b50d4c26aa32072fd3f9c311a0e773527abd Reviewed-by: Christian Stromme <christian.stromme@digia.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src/corelib/concurrent')
-rw-r--r--src/corelib/concurrent/qfutureinterface.cpp10
-rw-r--r--src/corelib/concurrent/qfutureinterface.h15
-rw-r--r--src/corelib/concurrent/qfutureinterface_p.h26
3 files changed, 5 insertions, 46 deletions
diff --git a/src/corelib/concurrent/qfutureinterface.cpp b/src/corelib/concurrent/qfutureinterface.cpp
index 6853a1a..9668e5d 100644
--- a/src/corelib/concurrent/qfutureinterface.cpp
+++ b/src/corelib/concurrent/qfutureinterface.cpp
@@ -419,16 +419,6 @@ 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),
diff --git a/src/corelib/concurrent/qfutureinterface.h b/src/corelib/concurrent/qfutureinterface.h
index dfe7941..30bfbdb 100644
--- a/src/corelib/concurrent/qfutureinterface.h
+++ b/src/corelib/concurrent/qfutureinterface.h
@@ -132,8 +132,6 @@ public:
protected:
bool referenceCountIsOne() const;
- bool refT() const;
- bool derefT() const;
public:
#ifndef QFUTURE_TEST
@@ -152,17 +150,13 @@ class QFutureInterface : public QFutureInterfaceBase
public:
QFutureInterface(State initialState = NoState)
: QFutureInterfaceBase(initialState)
- {
- refT();
- }
+ { }
QFutureInterface(const QFutureInterface &other)
: QFutureInterfaceBase(other)
- {
- refT();
- }
+ { }
~QFutureInterface()
{
- if (!derefT())
+ if (referenceCountIsOne())
resultStore().clear();
}
@@ -171,8 +165,7 @@ public:
QFutureInterface &operator=(const QFutureInterface &other)
{
- other.refT();
- if (!derefT())
+ if (referenceCountIsOne())
resultStore().clear();
QFutureInterfaceBase::operator=(other);
return *this;
diff --git a/src/corelib/concurrent/qfutureinterface_p.h b/src/corelib/concurrent/qfutureinterface_p.h
index 8431b1a..407c926 100644
--- a/src/corelib/concurrent/qfutureinterface_p.h
+++ b/src/corelib/concurrent/qfutureinterface_p.h
@@ -129,31 +129,7 @@ class QFutureInterfaceBasePrivate
public:
QFutureInterfaceBasePrivate(QFutureInterfaceBase::State initialState);
- // When the last QFuture<T> reference is removed, we need to make
- // sure that data stored in the ResultStore is cleaned out.
- // Since QFutureInterfaceBasePrivate can be shared between QFuture<T>
- // and QFuture<void> objects, we use a separate ref. counter
- // to keep track of QFuture<T> objects.
- class RefCount
- {
- public:
- inline RefCount(int r = 0, int rt = 0)
- : m_refCount(r), m_refCountT(rt) {}
- // Default ref counter for QFIBP
- inline bool ref() { return m_refCount.ref(); }
- inline bool deref() { return m_refCount.deref(); }
- // Ref counter for type T
- inline bool refT() { return m_refCountT.ref(); }
- inline bool derefT() { return m_refCountT.deref(); }
- inline operator int() const { return int(m_refCount); }
- inline bool operator==(int value) const { return m_refCount == value; }
-
- private:
- QAtomicInt m_refCount;
- QAtomicInt m_refCountT;
- };
-
- RefCount refCount;
+ QAtomicInt refCount;
mutable QMutex m_mutex;
QWaitCondition waitCondition;
QList<QFutureCallOutInterface *> outputConnections;