Skip to content

Fix IPlugView leaks for VST3 plugins#298

Closed
robbert-vdh wants to merge 1 commit intorncbc:masterfrom
robbert-vdh:fix/vst3-plug-view-leaks
Closed

Fix IPlugView leaks for VST3 plugins#298
robbert-vdh wants to merge 1 commit intorncbc:masterfrom
robbert-vdh:fix/vst3-plug-view-leaks

Conversation

@robbert-vdh
Copy link
Copy Markdown
Contributor

Hi,

I noticed that a lot of Windows VST3 plugins running through yabridge were having issues with Qtractor. When I looked into this I noticed that Qtractor creates an IPlugView instance during the plugin's initialization, but it then never drops it again and instead it a second IPlugView instance while the first one is still alive. I guess some plugins just don't like this.

The issue was that reference counting through IPtr<IPlugView> wasn't done correctly, so those objects would always stay at a reference count of at least 1 even when those smart pointers were dropped and the instances would thus never get destroyed. The solution is to use Steinberg::owned() whenever a call to a VST3 interface function returns a pointer. That function allows assignment to a smart pointer without increasing the reference count (which will be at 1 by default). I haven't really checked if this same issue also applied elsewhere, but from a quick skim everything else looks correct!

These `IPlugView` instances were not getting deallocated and thus
cleaned up because `IPtr<T> = x;` increases `x`'s reference count if you
don't explicitly make the `IPtr` owning using `Steinberg::owned` (or
passing a boolean to `IPtr`'s constructor/using `OPtr`). This meant that
plugins would always have at least two open `IPlugView` instances and
that they would never be destroyed.
@rncbc
Copy link
Copy Markdown
Owner

rncbc commented Feb 13, 2021

merged in 8b53a57 on develop branch

thanks

@rncbc rncbc closed this Feb 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants