From 2f04d6a846fa56f2fdbbc7ce3e3a790369da8ded Mon Sep 17 00:00:00 2001 From: reuk Date: Wed, 19 May 2021 23:33:55 +0100 Subject: [PATCH] VST3 Client: Fix leak caused by unnecessary manual refcounting In older versions of the VST3SDK, hostContext is a raw pointer, in newer versions it's a smart pointer. If we do manual refcounting with the smart pointer, we may cause leaks. --- .../juce_audio_plugin_client/VST3/juce_VST3_Wrapper.cpp | 8 -------- 1 file changed, 8 deletions(-) diff --git a/modules/juce_audio_plugin_client/VST3/juce_VST3_Wrapper.cpp b/modules/juce_audio_plugin_client/VST3/juce_VST3_Wrapper.cpp index 5130a9a8f1..4eabeddcdf 100644 --- a/modules/juce_audio_plugin_client/VST3/juce_VST3_Wrapper.cpp +++ b/modules/juce_audio_plugin_client/VST3/juce_VST3_Wrapper.cpp @@ -652,16 +652,8 @@ public: tresult PLUGIN_API initialize (FUnknown* context) override { if (hostContext != context) - { - if (hostContext != nullptr) - hostContext->release(); - hostContext = context; - if (hostContext != nullptr) - hostContext->addRef(); - } - return kResultTrue; }