From cd5369c7cd8022c8c8d338aff498c9d0483e8709 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Fri, 27 Oct 2023 04:43:44 +0200 Subject: [PATCH] Unload VST3 modules when closing session This is perhaps a better solution than b8551eed7ef and 8d0a6556080 and 7942897d93136. It is certainly less fragile. It is more consistent with other plugin standards, where modules are closed with the last instance in a session. Then again keeping the VST3 factory around is beneficial when switching snapshots. Discuss, and let's watch for issues when re-loading a previously unloaded VST3 module. --- libs/ardour/session.cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc index 9250d33f17..64e9d77676 100644 --- a/libs/ardour/session.cc +++ b/libs/ardour/session.cc @@ -134,6 +134,7 @@ #include "ardour/utils.h" #include "ardour/vca_manager.h" #include "ardour/vca.h" +#include "ardour/vst3_plugin.h" #include "midi++/port.h" #include "midi++/mmc.h" @@ -864,6 +865,11 @@ Session::destroy () _transport_fsm->stop (); + /* close VST3 Modules */ + for (auto const& nfo : PluginManager::instance().vst3_plugin_info()) { + std::dynamic_pointer_cast (nfo)->m.reset (); + } + DEBUG_TRACE (DEBUG::Destruction, "Session::destroy() done\n"); #ifndef NDEBUG