cpi.descriptor->destroy (cpi.descriptor, cpi.protocol);
if (lock_required) {
+ /* the lock is required when the protocol is torn down by a user from the GUI. */
Glib::Threads::RWLock::WriterLock lm (protocols_lock);
list<ControlProtocol*>::iterator p = find (control_protocols.begin(), control_protocols.end(), cpi.protocol);
if (p != control_protocols.end()) {
cpi.protocol = 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
if ((*i)->protocol) {
XMLNode& child_state ((*i)->protocol->get_state());
child_state.set_property (X_("active"), true);
+ delete ((*i)->state);
+ (*i)->state = new XMLNode (child_state);
root->add_child_nocopy (child_state);
} else if ((*i)->state) {
XMLNode* child_state = new XMLNode (*(*i)->state);