Fix crash on close, do not setup worker threads

Signed-off-by: falkTX <falktx@falktx.com>
This commit is contained in:
falkTX 2021-10-31 12:38:07 +00:00
parent ff5f9f6285
commit 86fbd84cf6
No known key found for this signature in database
GPG key ID: CDBAA37ABC74FBA0
3 changed files with 29 additions and 4 deletions

View file

@ -94,7 +94,7 @@ struct Initializer
#ifdef __MOD_DEVICES__
settings::threadCount = 3;
#else
settings::threadCount = 1;
settings::threadCount = 0;
#endif
system::init();
@ -768,7 +768,10 @@ protected:
const MutexLocker cml(fDeviceMutex);
if (fCurrentAudioDevice != nullptr)
{
rack::contextSet(context);
fCurrentAudioDevice->onStartStream();
}
}
}
@ -778,7 +781,10 @@ protected:
const MutexLocker cml(fDeviceMutex);
if (fCurrentAudioDevice != nullptr)
{
rack::contextSet(context);
fCurrentAudioDevice->onStopStream();
}
}
delete[] fAudioBufferOut;
@ -866,6 +872,13 @@ protected:
}
}
void sampleRateChanged(const double newSampleRate) override
{
rack::contextSet(context);
rack::settings::sampleRate = newSampleRate;
context->engine->setSampleRate(newSampleRate);
}
// -------------------------------------------------------------------------------------------------------
private:

View file

@ -129,10 +129,12 @@ public:
~CardinalUI() override
{
const ScopedContext sc(this);
rack::contextSet(fContext);
delete fContext->window;
fContext->window = nullptr;
rack::contextSet(nullptr);
}
void onNanoDisplay() override
@ -513,9 +515,8 @@ protected:
if (filename == nullptr)
return;
// we cannot lock here
// const ScopedContext sc(this);
rack::contextSet(fContext);
WindowParametersRestore(fContext->window);
fContext->patch->loadAction(filename);
}