From 7fdc826f8354cfaae031461f6714106aaaa8bb05 Mon Sep 17 00:00:00 2001 From: tildearrow Date: Sun, 21 Apr 2024 12:47:25 -0500 Subject: [PATCH] fix possible crash when changing colors if chan osc threads >= 0 --- src/engine/workPool.cpp | 14 ++++++++++---- src/gui/settings.cpp | 10 ++++++---- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/src/engine/workPool.cpp b/src/engine/workPool.cpp index b7372f082..20a64ac32 100644 --- a/src/engine/workPool.cpp +++ b/src/engine/workPool.cpp @@ -95,7 +95,11 @@ bool DivWorkThread::busy() { void DivWorkThread::finish() { lock.lock(); terminate=true; - notify.set_value(); + try { + notify.set_value(); + } catch (std::future_error& e) { + logE("future error! beware!"); + } lock.unlock(); thread->join(); } @@ -196,9 +200,11 @@ DivWorkPool::DivWorkPool(unsigned int threads): DivWorkPool::~DivWorkPool() { if (threaded) { - for (unsigned int i=0; i