mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
Convolution: Fix issue where old convolution engines were sometimes used after calling prepare
The startThread/stopThread calls were moved to prevent a thread sanitizer warning about a race on the vtable of Impl.
This commit is contained in:
parent
3de4fab219
commit
5ab6042c04
1 changed files with 13 additions and 11 deletions
|
|
@ -77,14 +77,7 @@ class BackgroundMessageQueue : private Thread
|
|||
public:
|
||||
explicit BackgroundMessageQueue (int entries)
|
||||
: Thread ("Convolution background loader"), queue (entries)
|
||||
{
|
||||
startThread();
|
||||
}
|
||||
|
||||
~BackgroundMessageQueue() override
|
||||
{
|
||||
stopThread (-1);
|
||||
}
|
||||
{}
|
||||
|
||||
using IncomingCommand = FixedSizeFunction<400, void()>;
|
||||
|
||||
|
|
@ -93,6 +86,9 @@ public:
|
|||
// This function is only safe to call from a single thread at a time.
|
||||
bool push (IncomingCommand& command) { return queue.push (command); }
|
||||
|
||||
using Thread::startThread;
|
||||
using Thread::stopThread;
|
||||
|
||||
private:
|
||||
void run() override
|
||||
{
|
||||
|
|
@ -119,9 +115,14 @@ ConvolutionMessageQueue::ConvolutionMessageQueue()
|
|||
|
||||
ConvolutionMessageQueue::ConvolutionMessageQueue (int entries)
|
||||
: pimpl (std::make_unique<Impl> (entries))
|
||||
{}
|
||||
{
|
||||
pimpl->startThread();
|
||||
}
|
||||
|
||||
ConvolutionMessageQueue::~ConvolutionMessageQueue() noexcept = default;
|
||||
ConvolutionMessageQueue::~ConvolutionMessageQueue() noexcept
|
||||
{
|
||||
pimpl->stopThread (-1);
|
||||
}
|
||||
|
||||
ConvolutionMessageQueue::ConvolutionMessageQueue (ConvolutionMessageQueue&&) noexcept = default;
|
||||
ConvolutionMessageQueue& ConvolutionMessageQueue::operator= (ConvolutionMessageQueue&&) noexcept = default;
|
||||
|
|
@ -1016,7 +1017,8 @@ public:
|
|||
{
|
||||
mixer.prepare (spec);
|
||||
engineQueue->prepare (spec);
|
||||
installPendingEngine();
|
||||
currentEngine = engineQueue->getEngine();
|
||||
previousEngine = nullptr;
|
||||
jassert (currentEngine != nullptr);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue