rncbc / qtractor

Qtractor - An Audio/MIDI multi-track sequencer
https://qtractor.org
GNU General Public License v2.0
509 stars 88 forks source link

Fix IPlugView leaks for VST3 plugins #298

Closed robbert-vdh closed 3 years ago

robbert-vdh commented 3 years ago

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!

rncbc commented 3 years ago

merged in 8b53a57f on develop branch

thanks