mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
AudioProcessorGraph: Fix race condition when destroying AudioProcessorGraph on a background thread
This commit is contained in:
parent
8fc76c4376
commit
dcef8b88b2
1 changed files with 4 additions and 9 deletions
|
|
@ -1677,17 +1677,11 @@ bool AudioProcessorGraph::Connection::operator< (const Connection& other) const
|
|||
}
|
||||
|
||||
//==============================================================================
|
||||
class AudioProcessorGraph::Pimpl : public AsyncUpdater
|
||||
class AudioProcessorGraph::Pimpl
|
||||
{
|
||||
public:
|
||||
explicit Pimpl (AudioProcessorGraph& o) : owner (&o) {}
|
||||
|
||||
~Pimpl() override
|
||||
{
|
||||
cancelPendingUpdate();
|
||||
clear (UpdateKind::sync);
|
||||
}
|
||||
|
||||
const auto& getNodes() const { return nodes.getNodes(); }
|
||||
|
||||
void clear (UpdateKind updateKind)
|
||||
|
|
@ -1840,7 +1834,7 @@ public:
|
|||
if (updateKind == UpdateKind::sync && MessageManager::getInstance()->isThisTheMessageThread())
|
||||
handleAsyncUpdate();
|
||||
else
|
||||
triggerAsyncUpdate();
|
||||
updater.triggerAsyncUpdate();
|
||||
}
|
||||
|
||||
void reset()
|
||||
|
|
@ -1902,7 +1896,7 @@ private:
|
|||
rebuild (updateKind);
|
||||
}
|
||||
|
||||
void handleAsyncUpdate() override
|
||||
void handleAsyncUpdate()
|
||||
{
|
||||
if (const auto newSettings = nodeStates.applySettings (nodes))
|
||||
{
|
||||
|
|
@ -1933,6 +1927,7 @@ private:
|
|||
RenderSequenceExchange renderSequenceExchange;
|
||||
NodeID lastNodeID;
|
||||
std::optional<RenderSequenceSignature> lastBuiltSequence;
|
||||
LockingAsyncUpdater updater { [this] { handleAsyncUpdate(); } };
|
||||
};
|
||||
|
||||
//==============================================================================
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue