diff options
author | Robin Gareus <robin@gareus.org> | 2017-08-03 19:16:33 +0200 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2017-08-03 19:25:14 +0200 |
commit | 1937c74191468b4e9e4baa251bb6329a3818d8e4 (patch) | |
tree | 8e65670394849f48d0128a2585c89bf2f83f01f3 | |
parent | 8b380a423a4aecfeccb5a26fa418937810b81cef (diff) |
Ignore cycle-start/end for unregistered ports
Should fix a race during Session::destroy(), Port::PortDrop
which unregisters ports with the backend, but the actual port instance
will still exist.
The engine does no longer have a session-pointer and only calls
CycleStart(); CycleEnd() to clear port-buffers. Trying to clear
and already unregistered Port will crash.
-rw-r--r-- | libs/ardour/audio_port.cc | 12 | ||||
-rw-r--r-- | libs/ardour/midi_port.cc | 2 |
2 files changed, 7 insertions, 7 deletions
diff --git a/libs/ardour/audio_port.cc b/libs/ardour/audio_port.cc index 33e41c10ad..f559578e4e 100644 --- a/libs/ardour/audio_port.cc +++ b/libs/ardour/audio_port.cc @@ -58,12 +58,12 @@ AudioPort::cycle_start (pframes_t nframes) void AudioPort::cycle_end (pframes_t nframes) { - if (sends_output() && !_buffer->written()) { - if (!_buffer->data (0)) { - get_audio_buffer (nframes); - } - if (_buffer->capacity() >= nframes) { - _buffer->silence (nframes); + if (sends_output() && !_buffer->written() && _port_handle) { + if (!_buffer->data (0)) { + get_audio_buffer (nframes); + } + if (_buffer->capacity() >= nframes) { + _buffer->silence (nframes); } } } diff --git a/libs/ardour/midi_port.cc b/libs/ardour/midi_port.cc index 05d9da5971..9a52aef3c6 100644 --- a/libs/ardour/midi_port.cc +++ b/libs/ardour/midi_port.cc @@ -65,7 +65,7 @@ MidiPort::cycle_start (pframes_t nframes) _buffer->clear (); - if (sends_output ()) { + if (sends_output () && _port_handle) { port_engine.midi_clear (port_engine.get_buffer (_port_handle, nframes)); } |