13
0

Prevent duplicate Ctrl-protocol instances

ControlProtocols are single instance.

Activating an already active protocol leads to crashes due to
various rasons (e.g. port already registered), re-used singleton
event_loop_name and request-buffers, duplicate free of
AbstractUI request buffers during deactivate,..
This commit is contained in:
Robin Gareus 2019-09-05 18:59:26 +02:00
parent 22e5c1de0d
commit 9bb2f2bb69
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04

View File

@ -129,6 +129,11 @@ ControlProtocolManager::activate (ControlProtocolInfo& cpi)
cpi.requested = true; cpi.requested = true;
if (cpi.protocol && cpi.protocol->active()) {
warning << string_compose (_("Control protocol %1 was already active."), cpi.name) << endmsg;
return 0;
}
if ((cp = instantiate (cpi)) == 0) { if ((cp = instantiate (cpi)) == 0) {
return -1; return -1;
} }