From c84f7085ca15549b9f8bed7f1e9335bb1c2f5baf Mon Sep 17 00:00:00 2001 From: jules Date: Tue, 11 Feb 2014 12:52:30 +0000 Subject: [PATCH] Fix for VST3 host view ref-counting. --- .../format_types/juce_VST3PluginFormat.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/modules/juce_audio_processors/format_types/juce_VST3PluginFormat.cpp b/modules/juce_audio_processors/format_types/juce_VST3PluginFormat.cpp index 8de72a1866..7640e50f8e 100644 --- a/modules/juce_audio_processors/format_types/juce_VST3PluginFormat.cpp +++ b/modules/juce_audio_processors/format_types/juce_VST3PluginFormat.cpp @@ -998,7 +998,8 @@ private: void releaseFactory() { - const Steinberg::FReleaser releaser (factory); + if (factory != nullptr) + factory->release(); } #if JUCE_WINDOWS @@ -1222,7 +1223,7 @@ public: [pluginHandle release]; #endif - const Steinberg::FReleaser releaser (view); + view = nullptr; } JUCE_DECLARE_VST3_COM_REF_METHODS @@ -1284,7 +1285,8 @@ public: dummyComponent.setBounds (0, 0, (int) rect.getWidth(), (int) rect.getHeight()); #endif - Desktop::getInstance().getMainMouseSource().forceMouseCursorUpdate(); // Some plugins don't update their cursor correctly when mousing out the window + // Some plugins don't update their cursor correctly when mousing out the window + Desktop::getInstance().getMainMouseSource().forceMouseCursorUpdate(); recursiveResize = false; } @@ -1316,7 +1318,7 @@ public: private: //============================================================================== Atomic refCount; - IPlugView* view; // N.B.: Don't use a ComSmartPtr here! The view should start with a refCount of 1, and does NOT need to be incremented! + ComSmartPtr view; #if JUCE_WINDOWS class ChildComponent : public Component @@ -1452,7 +1454,8 @@ public: if (! fetchComponentAndController (factory, factory->countClasses())) return false; - editController->initialize (host->getFUnknown()); // (May return an error if the plugin combines the IComponent and IEditController implementations) + // (May return an error if the plugin combines the IComponent and IEditController implementations) + editController->initialize (host->getFUnknown()); isControllerInitialised = true; editController->setComponentHandler (host);