From 55afdc2aa45c80312289209902c29008690b96af Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Fri, 9 Jun 2023 16:17:22 +0200 Subject: [PATCH] amend 7c7bf6c88b, do not notify UI during cleanup This fixes a rare crash where the signal causes a cxa_pure_virtual in PBD::Signal1 during destruction. --- libs/ardour/ardour/transport_master_manager.h | 2 +- libs/ardour/globals.cc | 2 +- libs/ardour/transport_master_manager.cc | 6 ++++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/libs/ardour/ardour/transport_master_manager.h b/libs/ardour/ardour/transport_master_manager.h index 8b27adedda..a67b7a122c 100644 --- a/libs/ardour/ardour/transport_master_manager.h +++ b/libs/ardour/ardour/transport_master_manager.h @@ -52,7 +52,7 @@ class LIBARDOUR_API TransportMasterManager : public boost::noncopyable int add (SyncSource type, std::string const & name, bool removeable = true); int remove (std::string const & name); - void clear (); + void clear (bool emit = true); PBD::Signal1 > Added; PBD::Signal1 > Removed; // null argument means "clear" diff --git a/libs/ardour/globals.cc b/libs/ardour/globals.cc index 4a0d0979a9..2dc0589661 100644 --- a/libs/ardour/globals.cc +++ b/libs/ardour/globals.cc @@ -754,7 +754,7 @@ ARDOUR::cleanup () engine_startup_connection.disconnect (); delete &ControlProtocolManager::instance (); - ARDOUR::TransportMasterManager::instance ().clear (); + ARDOUR::TransportMasterManager::instance ().clear (false); ARDOUR::AudioEngine::destroy (); ARDOUR::TransportMasterManager::destroy (); diff --git a/libs/ardour/transport_master_manager.cc b/libs/ardour/transport_master_manager.cc index 84058fb137..3c4c645f47 100644 --- a/libs/ardour/transport_master_manager.cc +++ b/libs/ardour/transport_master_manager.cc @@ -582,7 +582,7 @@ TransportMasterManager::set_current (std::string const & str) void -TransportMasterManager::clear () +TransportMasterManager::clear (bool emit) { { Glib::Threads::RWLock::WriterLock lm (lock); @@ -590,7 +590,9 @@ TransportMasterManager::clear () _transport_masters.clear (); } - Removed (std::shared_ptr()); + if (emit) { + Removed (std::shared_ptr()); + } } int