13
0

make IO::disconnect (port,port) symmetric with IO::connect (port,port) by requiring caller to hold process lock

git-svn-id: svn://localhost/ardour2/branches/3.0@8106 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Paul Davis 2010-11-27 16:42:44 +00:00
parent 30d64f31ac
commit 27cf00a598

View File

@ -159,34 +159,33 @@ IO::check_bundles (std::vector<UserBundleInfo*>& list, const PortSet& ports)
int
IO::disconnect (Port* our_port, string other_port, void* src)
{
assert (!AudioEngine::instance()->process_lock().trylock());
if (other_port.length() == 0 || our_port == 0) {
return 0;
}
{
BLOCK_PROCESS_CALLBACK ();
{
Glib::Mutex::Lock lm (io_lock);
/* check that our_port is really one of ours */
if ( ! _ports.contains(our_port)) {
return -1;
}
/* disconnect it from the source */
if (our_port->disconnect (other_port)) {
error << string_compose(_("IO: cannot disconnect port %1 from %2"), our_port->name(), other_port) << endmsg;
return -1;
}
check_bundles_connected ();
}
changed (IOChange (IOChange::ConnectionsChanged), src); /* EMIT SIGNAL */
}
{
Glib::Mutex::Lock lm (io_lock);
/* check that our_port is really one of ours */
if ( ! _ports.contains(our_port)) {
return -1;
}
/* disconnect it from the source */
if (our_port->disconnect (other_port)) {
error << string_compose(_("IO: cannot disconnect port %1 from %2"), our_port->name(), other_port) << endmsg;
return -1;
}
check_bundles_connected ();
}
changed (IOChange (IOChange::ConnectionsChanged), src); /* EMIT SIGNAL */
_session.set_dirty ();