X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=libs%2Fardour%2Fport.cc;h=06169dd576634441afc378027c5df063ece1bd9f;hb=dac57703ccd7205ac94c14b407b802a69f4187f1;hp=677a9fba1e9a5fdbf076efa0d8a749a9fc665fff;hpb=dd89363292ca02f223ac17dbe72048810be5edfd;p=ardour.git diff --git a/libs/ardour/port.cc b/libs/ardour/port.cc index 677a9fba1e..06169dd576 100644 --- a/libs/ardour/port.cc +++ b/libs/ardour/port.cc @@ -73,7 +73,7 @@ Port::Port (std::string const & n, DataType t, PortFlags f) cerr << "Failed to register port \"" << _name << "\", reason is unknown from here\n"; throw failed_constructor (); } - + PortDrop.connect_same_thread (drop_connection, boost::bind (&Port::drop, this)); } @@ -119,7 +119,7 @@ Port::connected () const { if (_port_handle) { return (port_engine.connected (_port_handle) != 0); - } + } return false; } @@ -127,14 +127,22 @@ int Port::disconnect_all () { if (_port_handle) { - + + std::vector connections; + get_connections (connections); + port_engine.disconnect_all (_port_handle); _connections.clear (); - - /* a cheaper, less hacky way to do boost::shared_from_this() ... + + /* a cheaper, less hacky way to do boost::shared_from_this() ... */ boost::shared_ptr pself = port_manager->get_port_by_name (name()); - PostDisconnect (pself, boost::shared_ptr()); // emit signal + for (vector::const_iterator c = connections.begin(); c != connections.end() && pself; ++c) { + boost::shared_ptr pother = AudioEngine::instance()->get_port_by_name (*c); + if (pother) { + PostDisconnect (pself, pother); // emit signal + } + } } return 0; @@ -147,7 +155,7 @@ bool Port::connected_to (std::string const & o) const { if (!_port_handle) { - return false; + return false; } if (!port_engine.available()) { @@ -217,7 +225,7 @@ Port::disconnect (std::string const & other) _connections.erase (other); } - /* a cheaper, less hacky way to do boost::shared_from_this() ... + /* a cheaper, less hacky way to do boost::shared_from_this() ... */ boost::shared_ptr pself = AudioEngine::instance()->get_port_by_name (name()); boost::shared_ptr pother = AudioEngine::instance()->get_port_by_name (other); @@ -227,7 +235,7 @@ Port::disconnect (std::string const & other) a check on whether this may affect anything that we need to know about. */ - PostDisconnect (pself, pother); // emit signal + PostDisconnect (pself, pother); // emit signal } return r; @@ -365,7 +373,7 @@ Port::public_latency_range (bool /*playback*/) const if (_port_handle) { r = port_engine.get_latency_range (_port_handle, sends_output() ? true : false); - + DEBUG_TRACE (DEBUG::Latency, string_compose ( "GET PORT %1: %4 PUBLIC latency range %2 .. %3\n", name(), r.min, r.max, @@ -520,7 +528,7 @@ Port::get_state () const } vector c; - + get_connections (c); for (vector::const_iterator i = c.begin(); i != c.end(); ++i) { @@ -554,7 +562,7 @@ Port::set_state (const XMLNode& node, int) if ((*c)->name() != X_("Connection")) { continue; } - + if ((prop = (*c)->property (X_("other"))) == 0) { continue; }