13
0

PortManager::unregister_port() must be called with process lock

This fixes "Failed to register <surface> port" when re-loading a session.
This commit is contained in:
Robin Gareus 2017-07-28 20:15:15 +02:00
parent 964b88e651
commit b5e0b5b09f
5 changed files with 12 additions and 2 deletions

View File

@ -37,6 +37,7 @@ MidiPortManager::MidiPortManager ()
MidiPortManager::~MidiPortManager ()
{
Glib::Threads::Mutex::Lock em (AudioEngine::instance()->process_lock());
if (_midi_in) {
AudioEngine::instance()->unregister_port (_midi_in);
}

View File

@ -200,6 +200,7 @@ FaderPort::~FaderPort ()
if (_input_port) {
DEBUG_TRACE (DEBUG::FaderPort, string_compose ("unregistering input port %1\n", boost::shared_ptr<ARDOUR::Port>(_input_port)->name()));
Glib::Threads::Mutex::Lock em (AudioEngine::instance()->process_lock());
AudioEngine::instance()->unregister_port (_input_port);
_input_port.reset ();
}
@ -207,6 +208,7 @@ FaderPort::~FaderPort ()
if (_output_port) {
_output_port->drain (10000, 250000); /* check every 10 msecs, wait up to 1/4 second for the port to drain */
DEBUG_TRACE (DEBUG::FaderPort, string_compose ("unregistering output port %1\n", boost::shared_ptr<ARDOUR::Port>(_output_port)->name()));
Glib::Threads::Mutex::Lock em (AudioEngine::instance()->process_lock());
AudioEngine::instance()->unregister_port (_output_port);
_output_port.reset ();
}

View File

@ -155,6 +155,7 @@ FaderPort8::~FaderPort8 ()
if (_input_port) {
DEBUG_TRACE (DEBUG::FaderPort8, string_compose ("unregistering input port %1\n", boost::shared_ptr<ARDOUR::Port>(_input_port)->name()));
Glib::Threads::Mutex::Lock em (AudioEngine::instance()->process_lock());
AudioEngine::instance()->unregister_port (_input_port);
_input_port.reset ();
}
@ -164,6 +165,7 @@ FaderPort8::~FaderPort8 ()
if (_output_port) {
_output_port->drain (10000, 250000); /* check every 10 msecs, wait up to 1/4 second for the port to drain */
DEBUG_TRACE (DEBUG::FaderPort8, string_compose ("unregistering output port %1\n", boost::shared_ptr<ARDOUR::Port>(_output_port)->name()));
Glib::Threads::Mutex::Lock em (AudioEngine::instance()->process_lock());
AudioEngine::instance()->unregister_port (_output_port);
_output_port.reset ();
}

View File

@ -92,6 +92,7 @@ SurfacePort::~SurfacePort()
} else {
if (_async_in) {
DEBUG_TRACE (DEBUG::MackieControl, string_compose ("unregistering input port %1\n", _async_in->name()));
Glib::Threads::Mutex::Lock em (AudioEngine::instance()->process_lock());
AudioEngine::instance()->unregister_port (_async_in);
_async_in.reset ((ARDOUR::Port*) 0);
}
@ -99,6 +100,7 @@ SurfacePort::~SurfacePort()
if (_async_out) {
_output_port->drain (10000, 250000);
DEBUG_TRACE (DEBUG::MackieControl, string_compose ("unregistering output port %1\n", _async_out->name()));
Glib::Threads::Mutex::Lock em (AudioEngine::instance()->process_lock());
AudioEngine::instance()->unregister_port (_async_out);
_async_out.reset ((ARDOUR::Port*) 0);
}

View File

@ -294,8 +294,11 @@ Push2::ports_release ()
asp = dynamic_cast<AsyncMIDIPort*> (_output_port);
asp->drain (10000, 500000);
{
Glib::Threads::Mutex::Lock em (AudioEngine::instance()->process_lock());
AudioEngine::instance()->unregister_port (_async_in);
AudioEngine::instance()->unregister_port (_async_out);
}
_async_in.reset ((ARDOUR::Port*) 0);
_async_out.reset ((ARDOUR::Port*) 0);