fix possible crash when changing colors

if chan osc threads >= 0
This commit is contained in:
tildearrow 2024-04-21 12:47:25 -05:00
parent ca5cf58d00
commit 7fdc826f83
2 changed files with 16 additions and 8 deletions

View file

@ -95,7 +95,11 @@ bool DivWorkThread::busy() {
void DivWorkThread::finish() { void DivWorkThread::finish() {
lock.lock(); lock.lock();
terminate=true; terminate=true;
notify.set_value(); try {
notify.set_value();
} catch (std::future_error& e) {
logE("future error! beware!");
}
lock.unlock(); lock.unlock();
thread->join(); thread->join();
} }
@ -196,9 +200,11 @@ DivWorkPool::DivWorkPool(unsigned int threads):
DivWorkPool::~DivWorkPool() { DivWorkPool::~DivWorkPool() {
if (threaded) { if (threaded) {
for (unsigned int i=0; i<count; i++) { if (workThreads!=NULL) {
workThreads[i].finish(); for (unsigned int i=0; i<count; i++) {
workThreads[i].finish();
}
delete[] workThreads;
} }
delete[] workThreads;
} }
} }

View file

@ -5437,10 +5437,12 @@ void FurnaceGUI::applyUISettings(bool updateFonts) {
} }
} }
// chan osc work pool if (updateFonts) {
if (chanOscWorkPool!=NULL) { // chan osc work pool
delete chanOscWorkPool; if (chanOscWorkPool!=NULL) {
chanOscWorkPool=NULL; delete chanOscWorkPool;
chanOscWorkPool=NULL;
}
} }
for (int i=0; i<64; i++) { for (int i=0; i<64; i++) {