diff options
Diffstat (limited to 'tests/auto/corelib')
-rw-r--r-- | tests/auto/corelib/thread/qthreadpool/tst_qthreadpool.cpp | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/tests/auto/corelib/thread/qthreadpool/tst_qthreadpool.cpp b/tests/auto/corelib/thread/qthreadpool/tst_qthreadpool.cpp index 49e1177e79..dede0be170 100644 --- a/tests/auto/corelib/thread/qthreadpool/tst_qthreadpool.cpp +++ b/tests/auto/corelib/thread/qthreadpool/tst_qthreadpool.cpp @@ -981,12 +981,16 @@ void tst_QThreadPool::cancel() count.ref(); } }; - typedef BlockingRunnable* BlockingRunnablePtr; + + enum { + MaxThreadCount = 3, + OverProvisioning = 2, + runs = MaxThreadCount * OverProvisioning + }; QThreadPool threadPool; - threadPool.setMaxThreadCount(3); - int runs = 2 * threadPool.maxThreadCount(); - BlockingRunnablePtr* runnables = new BlockingRunnablePtr[runs]; + threadPool.setMaxThreadCount(MaxThreadCount); + BlockingRunnable *runnables[runs]; count.store(0); QAtomicInt dtorCounter = 0; QAtomicInt runCounter = 0; @@ -1009,7 +1013,6 @@ void tst_QThreadPool::cancel() QCOMPARE(dtorCounter.load(), runs - 2); delete runnables[0]; //if the pool deletes them then we'll get double-free crash delete runnables[runs-1]; - delete[] runnables; } void tst_QThreadPool::destroyingWaitsForTasksToFinish() |