From 174d58fd877eb3f060908811b49bd01685fa2fc7 Mon Sep 17 00:00:00 2001 From: Jean Pierre Cimalando Date: Mon, 20 Sep 2021 03:03:36 +0200 Subject: [PATCH] Fix the VST thread synchronization on activate/deactivate --- plugins/vst/SfizzVstProcessor.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/plugins/vst/SfizzVstProcessor.cpp b/plugins/vst/SfizzVstProcessor.cpp index cf01f04f5..1e0a71346 100644 --- a/plugins/vst/SfizzVstProcessor.cpp +++ b/plugins/vst/SfizzVstProcessor.cpp @@ -740,8 +740,13 @@ void SfizzVstProcessor::doBackgroundWork() for (;;) { bool isNotified = _semaToWorker.timed_wait(kBackgroundIdleInterval.count()); - if (!_workRunning) + if (!_workRunning) { + // if the quit signal is sent, the semaphore is also signaled + // make sure the count is kept consistent + if (!isNotified) + _semaToWorker.wait(); break; + } const char* id = nullptr; RTMessagePtr msg;