1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

VST3 Client: Fix issue where active run loops could be removed incorrectly

The same run loop may be registered multiple times, e.g. if the host
passes the same run loop pointer to multiple instances of the plugin.
When a particular run loop client goes out of scope, it should only
remove its own reference to the run loop, because other clients may
still be active and still using that run loop.
This commit is contained in:
reuk 2024-07-08 16:47:50 +01:00
parent 6cc8827174
commit 695a51832b
No known key found for this signature in database
GPG key ID: FCB43929F012EE5C

View file

@ -214,7 +214,15 @@ public:
void unregisterHandlerForFrame (IPlugFrame* plugFrame)
{
if (auto* runLoop = getRunLoopFromFrame (plugFrame))
refreshAttachedEventLoop ([this, runLoop] { hostRunLoops.erase (runLoop); });
{
refreshAttachedEventLoop ([this, runLoop]
{
const auto it = hostRunLoops.find (runLoop);
if (it != hostRunLoops.end())
hostRunLoops.erase (it);
});
}
}
/* Asserts if it can be established that the calling thread is different from the host's message