mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
AudioProcessorGraph: Ensured that nodes are deleted soon after being removed from the graph
This commit is contained in:
parent
87d519759e
commit
11bd36b3ce
1 changed files with 19 additions and 1 deletions
|
|
@ -1326,9 +1326,19 @@ private:
|
|||
At the top of the audio callback, RenderSequenceExchange::updateAudioThreadState will
|
||||
attempt to install the most-recently-baked graph, if there's one waiting.
|
||||
*/
|
||||
class RenderSequenceExchange
|
||||
class RenderSequenceExchange : private Timer
|
||||
{
|
||||
public:
|
||||
RenderSequenceExchange()
|
||||
{
|
||||
startTimer (500);
|
||||
}
|
||||
|
||||
~RenderSequenceExchange() override
|
||||
{
|
||||
stopTimer();
|
||||
}
|
||||
|
||||
void set (std::unique_ptr<RenderSequence>&& next)
|
||||
{
|
||||
const SpinLock::ScopedLockType lock (mutex);
|
||||
|
|
@ -1353,6 +1363,14 @@ public:
|
|||
RenderSequence* getAudioThreadState() const { return audioThreadState.get(); }
|
||||
|
||||
private:
|
||||
void timerCallback() override
|
||||
{
|
||||
const SpinLock::ScopedLockType lock (mutex);
|
||||
|
||||
if (! isNew)
|
||||
mainThreadState.reset();
|
||||
}
|
||||
|
||||
SpinLock mutex;
|
||||
std::unique_ptr<RenderSequence> mainThreadState, audioThreadState;
|
||||
bool isNew = false;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue