13
0

trigger_ui: better connection management: watch both the Trigger and the Box

This commit is contained in:
Ben Loftis 2022-01-11 09:45:46 -06:00
parent 192d513cba
commit 07738e815b
2 changed files with 9 additions and 4 deletions

View File

@ -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 ());
}

View File

@ -124,7 +124,7 @@ protected:
PBD::ScopedConnection trigger_swap_connection;
ARDOUR::TriggerReference tref;
PBD::ScopedConnection trigger_connections;
PBD::ScopedConnectionList trigger_connections;
};