# HG changeset patch # User Chris Cannam # Date 1480506280 0 # Node ID 0d5c3abc965812805053cc2b399b6696178a1cd9 # Parent 630c4a9885cac11c40ee4907f4e7cde612a8e988 Delete audio I/O objects in a fixed order diff -r 630c4a9885ca -r 0d5c3abc9658 audio/AudioCallbackPlaySource.cpp --- a/audio/AudioCallbackPlaySource.cpp Fri Nov 25 10:08:52 2016 +0000 +++ b/audio/AudioCallbackPlaySource.cpp Wed Nov 30 11:44:40 2016 +0000 @@ -414,6 +414,8 @@ void AudioCallbackPlaySource::play(sv_frame_t startFrame) { + if (!m_target) return; + if (!m_sourceSampleRate) { cerr << "AudioCallbackPlaySource::play: No source sample rate available, not playing" << endl; return; diff -r 630c4a9885ca -r 0d5c3abc9658 framework/MainWindowBase.cpp --- a/framework/MainWindowBase.cpp Fri Nov 25 10:08:52 2016 +0000 +++ b/framework/MainWindowBase.cpp Wed Nov 30 11:44:40 2016 +0000 @@ -287,10 +287,25 @@ MainWindowBase::~MainWindowBase() { SVDEBUG << "MainWindowBase::~MainWindowBase" << endl; + + // We have to delete the breakfastquay::SystemPlaybackTarget or + // breakfastquay::SystemAudioIO object (whichever we have -- it + // depends on whether we handle recording or not) before we delete + // the ApplicationPlaybackSource and ApplicationRecordTarget that + // they refer to. + + // First prevent this trying to call target. + if (m_playSource) m_playSource->setSystemPlaybackTarget(0); + + // Then delete the breakfastquay::System object. + // Only one of these two exists! + delete m_audioIO; delete m_playTarget; + + // Then delete the Application objects. delete m_playSource; - delete m_audioIO; delete m_recordTarget; + delete m_viewManager; delete m_oscQueue; delete m_oscQueueStarter;