diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2012-11-18 22:54:41 (GMT) |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2012-11-19 23:27:56 (GMT) |
commit | 8ef339ed2fed66646f458c60b2e0e7ac560dad06 (patch) | |
tree | 38db8c86f4c27e68d8855820da49b0da9cac44b9 /tests | |
parent | 94be95934fb3f0ab339fd169ef529f05f1a6707d (diff) | |
download | Qt-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 'tests')
-rw-r--r-- | tests/auto/qfuture/tst_qfuture.cpp | 30 | ||||
-rw-r--r-- | tests/auto/qtconcurrentmap/tst_qtconcurrentmap.cpp | 43 |
2 files changed, 8 insertions, 65 deletions
diff --git a/tests/auto/qfuture/tst_qfuture.cpp b/tests/auto/qfuture/tst_qfuture.cpp index 0f1836c..f6ed5a9 100644 --- a/tests/auto/qfuture/tst_qfuture.cpp +++ b/tests/auto/qfuture/tst_qfuture.cpp @@ -1282,32 +1282,18 @@ void tst_QFuture::throttling() void tst_QFuture::voidConversions() { - { - QFutureInterface<int> iface; - iface.reportStarted(); - - QFuture<int> intFuture(&iface); - int value = 10; - iface.reportFinished(&value); + QFutureInterface<int> iface; + iface.reportStarted(); - QFuture<void> voidFuture(intFuture); - voidFuture = intFuture; + QFuture<int> intFuture(&iface); - QVERIFY(voidFuture == intFuture); - } + int value = 10; + iface.reportFinished(&value); - { - QFuture<void> voidFuture; - { - QFutureInterface<QList<int> > iface; - iface.reportStarted(); + QFuture<void> voidFuture(intFuture); + voidFuture = intFuture; - QFuture<QList<int> > listFuture(&iface); - iface.reportResult(QList<int>() << 1 << 2 << 3); - voidFuture = listFuture; - } - QCOMPARE(voidFuture.resultCount(), 0); - } + QVERIFY(voidFuture == intFuture); } diff --git a/tests/auto/qtconcurrentmap/tst_qtconcurrentmap.cpp b/tests/auto/qtconcurrentmap/tst_qtconcurrentmap.cpp index f8c4a36..43075f1 100644 --- a/tests/auto/qtconcurrentmap/tst_qtconcurrentmap.cpp +++ b/tests/auto/qtconcurrentmap/tst_qtconcurrentmap.cpp @@ -43,7 +43,6 @@ #include <qdebug.h> #include <QThread> -#include <QMutex> #include <QtTest/QtTest> @@ -77,7 +76,6 @@ private slots: void stlContainers(); void qFutureAssignmentLeak(); void stressTest(); - void persistentResultTest(); public slots: void throttling(); }; @@ -2418,47 +2416,6 @@ void tst_QtConcurrentMap::stressTest() } } -struct LockedCounter -{ - LockedCounter(QMutex *mutex, QAtomicInt *ai) - : mtx(mutex), - ref(ai) {} - - typedef int result_type; - int operator()(int x) - { - QMutexLocker locker(mtx); - ref->ref(); - return ++x; - } - - QMutex *mtx; - QAtomicInt *ref; -}; - -// The Thread engine holds the last reference -// to the QFuture, so this should not leak -// or fail. -void tst_QtConcurrentMap::persistentResultTest() -{ - QFuture<void> voidFuture; - QMutex mtx; - QAtomicInt ref; - LockedCounter lc(&mtx, &ref); - QList<int> list; - { - list << 1 << 2 << 3; - mtx.lock(); - QFuture<int> future = QtConcurrent::mapped(list - ,lc); - voidFuture = future; - } - QCOMPARE(int(ref), 0); - mtx.unlock(); // Unblock - voidFuture.waitForFinished(); - QCOMPARE(int(ref), 3); -} - QTEST_MAIN(tst_QtConcurrentMap) #else |