From 27cf00a5988345e177e1c57b133848754c1ae20d Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Sat, 27 Nov 2010 16:42:44 +0000 Subject: [PATCH] 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 --- libs/ardour/io.cc | 47 +++++++++++++++++++++++------------------------ 1 file changed, 23 insertions(+), 24 deletions(-) diff --git a/libs/ardour/io.cc b/libs/ardour/io.cc index de4d658596..0609726b23 100644 --- a/libs/ardour/io.cc +++ b/libs/ardour/io.cc @@ -159,34 +159,33 @@ IO::check_bundles (std::vector& 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 ();