From 33b642655bbd629baeeb1fb8e01a624bfb709e07 Mon Sep 17 00:00:00 2001 From: Nodir Temirkhodjaev Date: Sun, 25 Aug 2019 20:26:05 +0500 Subject: [PATCH] Fix last commit. --- src/ui/control/controlworker.cpp | 6 ++++++ src/ui/control/controlworker.h | 1 + 2 files changed, 7 insertions(+) diff --git a/src/ui/control/controlworker.cpp b/src/ui/control/controlworker.cpp index ea045af1..fcf2745d 100644 --- a/src/ui/control/controlworker.cpp +++ b/src/ui/control/controlworker.cpp @@ -9,6 +9,7 @@ ControlWorker::ControlWorker(QSystemSemaphore *semaphore, QObject *parent) : QObject(parent), m_aborted(false), + m_finished(false), m_semaphore(semaphore), m_sharedMemory(sharedMemory) { @@ -21,6 +22,8 @@ void ControlWorker::run() while (!m_aborted && m_semaphore->acquire()) { processRequest(); } + + m_finished = true; } void ControlWorker::abort() @@ -30,6 +33,9 @@ void ControlWorker::abort() m_semaphore->release(); m_mutex.lock(); + if (!m_finished) { + m_mutex.unlock(); + } } bool ControlWorker::post(const QString &scriptPath, diff --git a/src/ui/control/controlworker.h b/src/ui/control/controlworker.h index 06206ea7..1d64d7d4 100644 --- a/src/ui/control/controlworker.h +++ b/src/ui/control/controlworker.h @@ -42,6 +42,7 @@ private: private: volatile bool m_aborted; + volatile bool m_finished; QSystemSemaphore *m_semaphore; QSharedMemory *m_sharedMemory;