From 7b4d3874a62361563cf25409f9438fe0654eabf6 Mon Sep 17 00:00:00 2001 From: Mat Sutcliffe Date: Mon, 18 Feb 2019 15:50:11 +0000 Subject: [PATCH] Ref T541 Abandoned worker shouldn't interrupt if it's in the owner's thread. --- src/blackmisc/worker.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/blackmisc/worker.cpp b/src/blackmisc/worker.cpp index 917cdabbb..a281aec01 100644 --- a/src/blackmisc/worker.cpp +++ b/src/blackmisc/worker.cpp @@ -114,18 +114,19 @@ namespace BlackMisc void CWorkerBase::abandon() noexcept { - thread()->requestInterruption(); + if (thread() != thread()->thread()) { thread()->requestInterruption(); } quit(); } void CWorkerBase::abandonAndWait() noexcept { - thread()->requestInterruption(); + if (thread() != thread()->thread()) { thread()->requestInterruption(); } quitAndWait(); } bool CWorkerBase::isAbandoned() const { + Q_ASSERT(thread() == QThread::currentThread()); return thread()->isInterruptionRequested(); }