From 07738e815b7dd4482e2c42e7caeda7c57316ab16 Mon Sep 17 00:00:00 2001 From: Ben Loftis Date: Tue, 11 Jan 2022 09:45:46 -0600 Subject: [PATCH] trigger_ui: better connection management: watch both the Trigger and the Box --- gtk2_ardour/trigger_ui.cc | 11 ++++++++--- gtk2_ardour/trigger_ui.h | 2 +- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/gtk2_ardour/trigger_ui.cc b/gtk2_ardour/trigger_ui.cc index e8b0984cf1..ef044213cc 100644 --- a/gtk2_ardour/trigger_ui.cc +++ b/gtk2_ardour/trigger_ui.cc @@ -110,7 +110,7 @@ TriggerUI::TriggerUI () TriggerUI::~TriggerUI() { trigger_swap_connection.disconnect (); - trigger_connections.disconnect (); + trigger_connections.drop_connections (); } void @@ -120,8 +120,11 @@ TriggerUI::trigger_swap (uint32_t n) /* some other slot in the same box got swapped. we don't care */ return; } - trigger_connections.disconnect (); + trigger_connections.drop_connections (); + trigger()->PropertyChanged.connect (trigger_connections, MISSING_INVALIDATOR, boost::bind (&TriggerUI::trigger_changed, this, _1), gui_context ()); + tref.box->PropertyChanged.connect (trigger_connections, MISSING_INVALIDATOR, boost::bind (&TriggerUI::trigger_changed, this, _1), gui_context ()); + trigger_changed (Properties::name); } @@ -812,7 +815,7 @@ TriggerUI::trigger_changed (PropertyChange const& what) void TriggerUI::set_trigger (ARDOUR::TriggerReference tr) { - trigger_connections.disconnect(); + trigger_connections.drop_connections(); trigger_swap_connection.disconnect(); tref = tr; @@ -834,5 +837,7 @@ TriggerUI::set_trigger (ARDOUR::TriggerReference tr) trigger_changed (pc); trigger()->PropertyChanged.connect (trigger_connections, MISSING_INVALIDATOR, boost::bind (&TriggerUI::trigger_changed, this, _1), gui_context()); + tref.box->PropertyChanged.connect (trigger_connections, MISSING_INVALIDATOR, boost::bind (&TriggerUI::trigger_changed, this, _1), gui_context ()); + tref.box->TriggerSwapped.connect (trigger_swap_connection, MISSING_INVALIDATOR, boost::bind (&TriggerUI::trigger_swap, this, _1), gui_context ()); } diff --git a/gtk2_ardour/trigger_ui.h b/gtk2_ardour/trigger_ui.h index acdc94b402..b03390ed91 100644 --- a/gtk2_ardour/trigger_ui.h +++ b/gtk2_ardour/trigger_ui.h @@ -124,7 +124,7 @@ protected: PBD::ScopedConnection trigger_swap_connection; ARDOUR::TriggerReference tref; - PBD::ScopedConnection trigger_connections; + PBD::ScopedConnectionList trigger_connections; };