summaryrefslogtreecommitdiff
path: root/libs/ardour/control_protocol_manager.cc
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2017-04-21 03:47:26 +0200
committerRobin Gareus <robin@gareus.org>2017-04-21 04:08:08 +0200
commit44cec185162661586169126d5f482bc7a89fb3a5 (patch)
treeb531bb16eb17ebdce7aedefdacc7a8d9903e5fd2 /libs/ardour/control_protocol_manager.cc
parent661d258687e4f49d11a3a20b7a59cdaacaea0ffb (diff)
Retain state of disabled ctrl-surfaces
Diffstat (limited to 'libs/ardour/control_protocol_manager.cc')
-rw-r--r--libs/ardour/control_protocol_manager.cc22
1 files changed, 15 insertions, 7 deletions
diff --git a/libs/ardour/control_protocol_manager.cc b/libs/ardour/control_protocol_manager.cc
index 014c2209d6..ba32ab8b70 100644
--- a/libs/ardour/control_protocol_manager.cc
+++ b/libs/ardour/control_protocol_manager.cc
@@ -263,8 +263,14 @@ ControlProtocolManager::teardown (ControlProtocolInfo& cpi, bool lock_required)
cpi.protocol = 0;
- delete cpi.state;
- cpi.state = 0;
+ if (lock_required) {
+ /* the lock is only required when the protocol is torn down from the GUI.
+ * If a user disables a protocol, we take this as indicator to forget the
+ * state.
+ */
+ delete cpi.state;
+ cpi.state = 0;
+ }
delete (Glib::Module*) cpi.descriptor->module;
/* cpi->descriptor is now inaccessible since dlclose() or equivalent
* has been performed, and the descriptor is (or could be) a static
@@ -456,22 +462,24 @@ ControlProtocolManager::set_state (const XMLNode& node, int /*version*/)
ControlProtocolInfo* cpi = cpi_by_name (name);
if (cpi) {
- delete cpi->state;
- cpi->state = new XMLNode (**citer);
-
std::cerr << "protocol " << name << " active ? " << active << std::endl;
if (active) {
+ delete cpi->state;
+ cpi->state = new XMLNode (**citer);
if (_session) {
instantiate (*cpi);
} else {
cpi->requested = true;
}
} else {
+ if (!cpi->state) {
+ cpi->state = new XMLNode (**citer);
+ cpi->state->set_property (X_("active"), false);
+ }
+ cpi->requested = false;
if (_session) {
teardown (*cpi, false);
- } else {
- cpi->requested = false;
}
}
} else {