diff options
author | Mårten Nordheim <marten.nordheim@qt.io> | 2022-03-04 12:28:49 +0100 |
---|---|---|
committer | Mårten Nordheim <marten.nordheim@qt.io> | 2022-03-08 15:44:17 +0100 |
commit | 034d8898f8166423db085da529787e56204c8e15 (patch) | |
tree | f58e930c7880d1cd79cd39745ed366d27dcd9e55 /src/corelib/thread/qthreadpool.cpp | |
parent | 87725ee75981ec9ab25456c41acc74681c85ae2e (diff) | |
download | qtbase-034d8898f8166423db085da529787e56204c8e15.tar.gz |
Fix deprecated uses of QScopedPointer
By changing it to unique_ptr.
Pick-to: 6.2 6.3
Change-Id: I91abb69445b537d4c95983ae735341882352b29d
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/thread/qthreadpool.cpp')
-rw-r--r-- | src/corelib/thread/qthreadpool.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/corelib/thread/qthreadpool.cpp b/src/corelib/thread/qthreadpool.cpp index 94b0aff451..fee6354b0a 100644 --- a/src/corelib/thread/qthreadpool.cpp +++ b/src/corelib/thread/qthreadpool.cpp @@ -43,6 +43,7 @@ #include "qcoreapplication.h" #include <algorithm> +#include <memory> QT_BEGIN_NAMESPACE @@ -274,16 +275,16 @@ bool QThreadPoolPrivate::tooManyThreadsActive() const void QThreadPoolPrivate::startThread(QRunnable *runnable) { Q_ASSERT(runnable != nullptr); - QScopedPointer<QThreadPoolThread> thread(new QThreadPoolThread(this)); + auto thread = std::make_unique<QThreadPoolThread>(this); if (objectName.isEmpty()) objectName = QLatin1String("Thread (pooled)"); thread->setObjectName(objectName); - Q_ASSERT(!allThreads.contains(thread.data())); // if this assert hits, we have an ABA problem (deleted threads don't get removed here) - allThreads.insert(thread.data()); + Q_ASSERT(!allThreads.contains(thread.get())); // if this assert hits, we have an ABA problem (deleted threads don't get removed here) + allThreads.insert(thread.get()); ++activeThreads; thread->runnable = runnable; - thread.take()->start(threadPriority); + thread.release()->start(threadPriority); } /*! |