Fix of flaky qFutureAssignmentLeak test

Switch to QTRY_COMPARE since thread-local references might be held shortly
after finished is signalled.

Change-Id: Ia32f1f45f6cc461352558e0f2acf9612f8a4639e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Allan Sandfeld Jensen 2018-02-07 18:37:22 +01:00
parent dc334b60d9
commit 5e98873cd3
2 changed files with 5 additions and 5 deletions

View File

@ -1,3 +0,0 @@
[qFutureAssignmentLeak]
ci opensuse
ci ubuntu-16.04

View File

@ -2402,9 +2402,12 @@ void tst_QtConcurrentMap::qFutureAssignmentLeak()
future.waitForFinished();
}
QCOMPARE(currentInstanceCount.load(), 1000);
// Use QTRY_COMPARE because QtConcurrent::ThreadEngine::asynchronousFinish()
// deletes its internals after signaling finished, so it might still be holding
// on to copies of InstanceCounter for a short while.
QTRY_COMPARE(currentInstanceCount.load(), 1000);
future = QFuture<InstanceCounter>();
QCOMPARE(currentInstanceCount.load(), 0);
QTRY_COMPARE(currentInstanceCount.load(), 0);
}
inline void increment(int &num)