Fix crash when destroying session while control protocol is selected in preferences

The GUI should be notified about the tearing down of the control
surfaces *before* the protocols are actually destroyed.

On ProtocolStatusChange ControlSurfacesOptions::selection_changed() might try
to access protocol->has_editor() of a protocol that happens to be selected in
the preferences GUI. I this protocol already has been destroyed, a crash will
occur.
This commit is contained in:
Johannes Mueller 2019-04-17 13:44:02 +02:00
parent d686076711
commit 6d4d4ccc78

View File

@ -181,12 +181,6 @@ ControlProtocolManager::drop_protocols ()
Glib::Threads::RWLock::WriterLock lm (protocols_lock);
for (list<ControlProtocol*>::iterator p = control_protocols.begin(); p != control_protocols.end(); ++p) {
delete *p;
}
control_protocols.clear ();
for (list<ControlProtocolInfo*>::iterator p = control_protocol_info.begin(); p != control_protocol_info.end(); ++p) {
// mark existing protocols as requested
// otherwise the ControlProtocol instances are not recreated in set_session
@ -196,6 +190,12 @@ ControlProtocolManager::drop_protocols ()
ProtocolStatusChange (*p); /* EMIT SIGNAL */
}
}
for (list<ControlProtocol*>::iterator p = control_protocols.begin(); p != control_protocols.end(); ++p) {
delete *p;
}
control_protocols.clear ();
}
ControlProtocol*