13
0

Properly unload VST3 plugins

The InstrumentSelector keeps a PluginPtr reference to all
instruments. By default Ardour does not destroy the editor
at exit, So 3 instances of Instrument Selector can remain

 * TriggerClipPicker in the editor sidebar (owned by _editor)
 * TriggerClipPicker on the TriggerPage (owned by trigger_page)
 * SoundFileOmega (sfbrowser owned by Editor)

If a shared_ptr reference is retained, VST3 Module is not
unloaded at exit. This leads to issues with various plugins.
eg. Reason Rack does not terminate, Ardour hangs at exit.
This commit is contained in:
Robin Gareus 2023-10-27 00:39:03 +02:00
parent 49124ab987
commit b8551eed7e
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
3 changed files with 17 additions and 0 deletions

View File

@ -146,6 +146,7 @@
#include "gui_object.h"
#include "gui_thread.h"
#include "idleometer.h"
#include "instrument_selector.h"
#include "io_plugin_window.h"
#include "keyboard.h"
#include "keyeditor.h"
@ -868,6 +869,8 @@ ARDOUR_UI::~ARDOUR_UI ()
recorder->cleanup ();
}
InstrumentSelector::DropPluginInfoPtr ();
if (getenv ("ARDOUR_RUNNING_UNDER_VALGRIND")) {
// don't bother at 'real' exit. the OS cleans up for us.
delete big_clock; big_clock = 0;

View File

@ -29,6 +29,8 @@
using namespace Gtk;
using namespace ARDOUR;
sigc::signal<void> InstrumentSelector::DropPluginInfoPtr;
InstrumentSelector::InstrumentSelector (InstrumentListDisposition disp)
: _reasonable_synth_id (0)
, _gmsynth_id (UINT32_MAX)
@ -37,6 +39,15 @@ InstrumentSelector::InstrumentSelector (InstrumentListDisposition disp)
refill ();
PluginManager::instance ().PluginListChanged.connect (_update_connection, invalidator (*this), boost::bind (&InstrumentSelector::refill, this), gui_context());
DropPluginInfoPtr.connect (sigc::mem_fun (*this, &InstrumentSelector::drop_plugin_ptr));
}
void
InstrumentSelector::drop_plugin_ptr()
{
unset_model ();
clear ();
_instrument_list->clear ();
}
void

View File

@ -50,6 +50,8 @@ public:
ARDOUR::PluginInfoPtr selected_instrument () const;
std::string selected_instrument_name () const;
static sigc::signal<void> DropPluginInfoPtr;
private:
struct InstrumentListColumns : public Gtk::TreeModel::ColumnRecord {
InstrumentListColumns() {
@ -62,6 +64,7 @@ private:
void build_instrument_list();
void refill();
void drop_plugin_ptr();
std::string _longest_instrument_name;