CPM: precent concurrent protocol activision

This can happen when a device is already connected
while Arodur is stating. The butler thread may activate it
(immediately post-engine), while the GUI thread tries
to do the same later when restoring state.
This commit is contained in:
Robin Gareus
2023-05-04 18:42:30 +02:00
parent a258b82ce9
commit 617caf9e98

View File

@@ -194,16 +194,15 @@ ControlProtocolManager::set_session (Session* s)
int
ControlProtocolManager::activate (ControlProtocolInfo& cpi)
{
Glib::Threads::RWLock::WriterLock lm (protocols_lock);
ControlProtocol* cp;
cpi.requested = true;
if (cpi.protocol && cpi.protocol->active()) {
warning << string_compose (_("Control protocol %1 was already active."), cpi.name) << endmsg;
return 0;
}
Glib::Threads::RWLock::WriterLock lm (protocols_lock);
cpi.requested = true;
if ((cp = instantiate (cpi)) == 0) {
return -1;
}