From 8bc3e86066f0e6523219a1f3b9f4992e2d46b7d7 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Mon, 19 Oct 2020 16:37:30 +0200 Subject: [PATCH] Clean up TMM at exit --- libs/ardour/ardour/transport_master_manager.h | 1 + libs/ardour/globals.cc | 1 + libs/ardour/transport_master_manager.cc | 11 ++++++++++- 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/libs/ardour/ardour/transport_master_manager.h b/libs/ardour/ardour/transport_master_manager.h index 6035a18b8b..2a298f5093 100644 --- a/libs/ardour/ardour/transport_master_manager.h +++ b/libs/ardour/ardour/transport_master_manager.h @@ -41,6 +41,7 @@ class LIBARDOUR_API TransportMasterManager : public boost::noncopyable void engine_stopped (); static TransportMasterManager& instance(); + static void destroy(); /* this method is not thread-safe and is intended to be used only * very early in application-lifetime to check if the TMM has * been created yet. Do not use in other code. diff --git a/libs/ardour/globals.cc b/libs/ardour/globals.cc index 177ae6d325..03d73b7b2d 100644 --- a/libs/ardour/globals.cc +++ b/libs/ardour/globals.cc @@ -654,6 +654,7 @@ ARDOUR::cleanup () delete &ControlProtocolManager::instance (); ARDOUR::AudioEngine::destroy (); + ARDOUR::TransportMasterManager::destroy (); delete Library; #ifdef HAVE_LRDF diff --git a/libs/ardour/transport_master_manager.cc b/libs/ardour/transport_master_manager.cc index 779d10e7e0..127b9e6886 100644 --- a/libs/ardour/transport_master_manager.cc +++ b/libs/ardour/transport_master_manager.cc @@ -47,7 +47,9 @@ TransportMasterManager::TransportMasterManager() TransportMasterManager::~TransportMasterManager () { - clear (); + Glib::Threads::RWLock::WriterLock lm (lock); + _current_master.reset (); + _transport_masters.clear (); } TransportMasterManager& @@ -139,6 +141,13 @@ TransportMasterManager::instance() return *_instance; } +void +TransportMasterManager::destroy() +{ + delete _instance; + _instance = 0; +} + // Called from AudioEngine::process_callback() BEFORE Session::process() is called. Each transport master has processed any incoming data for this cycle, // and this method computes the transport speed that Ardour should use to get into and remain in sync with the master. //