From 969427980492f5079e197bfc3de3551806ee4940 Mon Sep 17 00:00:00 2001 From: Paul Licameli Date: Tue, 17 Oct 2017 06:17:06 -0400 Subject: [PATCH] Guard against crash when stopping a stream... ... caused by remembering a NULL pointer to active project when starting a stream. Hard to reproduce, but reported by David Bailes. We suspect that both the closing of another project window, and changes of focused application, are necessary to reproduce the problem. --- src/AudioIO.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/AudioIO.cpp b/src/AudioIO.cpp index a8d145dbc..a78bd1cab 100644 --- a/src/AudioIO.cpp +++ b/src/AudioIO.cpp @@ -1643,6 +1643,12 @@ bool AudioIO::StartPortAudioStream(double sampleRate, mAudioFramesPerBuffer = 0; #endif mOwningProject = GetActiveProject(); + + // PRL: Protection from crash reported by David Bailes, involving starting + // and stopping with frequent changes of active window, hard to reproduce + if (!mOwningProject) + return false; + mInputMeter = NULL; mOutputMeter = NULL;