diff options
Diffstat (limited to 'src/corelib/thread/qthreadpool.cpp')
-rw-r--r-- | src/corelib/thread/qthreadpool.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/corelib/thread/qthreadpool.cpp b/src/corelib/thread/qthreadpool.cpp index cdeb077233..5b1e4f4c33 100644 --- a/src/corelib/thread/qthreadpool.cpp +++ b/src/corelib/thread/qthreadpool.cpp @@ -602,8 +602,12 @@ bool QThreadPool::tryStart(std::function<void()> functionToRun) return false; QRunnable *runnable = QRunnable::create(std::move(functionToRun)); + Q_ASSERT(runnable->ref == 0); + ++runnable->ref; if (d->tryStart(runnable)) return true; + --runnable->ref; + Q_ASSERT(runnable->ref == 0); delete runnable; return false; } |