summaryrefslogtreecommitdiff
path: root/libs/ardour/control_group.cc
diff options
context:
space:
mode:
Diffstat (limited to 'libs/ardour/control_group.cc')
-rw-r--r--libs/ardour/control_group.cc14
1 files changed, 12 insertions, 2 deletions
diff --git a/libs/ardour/control_group.cc b/libs/ardour/control_group.cc
index 6752940d27..2fe6af26ef 100644
--- a/libs/ardour/control_group.cc
+++ b/libs/ardour/control_group.cc
@@ -104,9 +104,19 @@ ControlGroup::control_going_away (boost::weak_ptr<AutomationControl> wac)
int
ControlGroup::remove_control (boost::shared_ptr<AutomationControl> ac)
{
- Glib::Threads::RWLock::WriterLock lm (controls_lock);
+ int erased;
+
+ {
+ Glib::Threads::RWLock::WriterLock lm (controls_lock);
+ erased = _controls.erase (ac->id());
+ }
+
+ if (erased) {
+ ac->set_group (boost::shared_ptr<ControlGroup>());
+ }
+
/* return zero if erased, non-zero otherwise */
- return !(_controls.erase (ac->id()) > 0);
+ return !erased;
}
int