From 6cc4b047848e9759aff72986f7aef7867da7dd47 Mon Sep 17 00:00:00 2001 From: "james.k.crook@gmail.com" Date: Tue, 3 May 2011 12:00:45 +0000 Subject: [PATCH] Bug:382 Resetting control toolbar whilst audio was playing led to attempts by gAudio to update a non-existent window and crash on OSX. We now stop the current monitoring on a toolbar reset. --- src/Screenshot.cpp | 5 ++++- src/toolbars/ToolManager.cpp | 10 +++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/Screenshot.cpp b/src/Screenshot.cpp index 174f609eb..edde20770 100644 --- a/src/Screenshot.cpp +++ b/src/Screenshot.cpp @@ -281,7 +281,10 @@ ScreenFrame::ScreenFrame(wxWindow * parent, wxWindowID id) Populate(); - // Reset the toolbars to a known state + // Reset the toolbars to a known state. + // Note that the audio could be playing. + // The monitoring will switch off temporarily + // because we've switched monitor mid play. mContext.proj->mToolManager->Reset(); } diff --git a/src/toolbars/ToolManager.cpp b/src/toolbars/ToolManager.cpp index 43fe210f8..fec4042ed 100644 --- a/src/toolbars/ToolManager.cpp +++ b/src/toolbars/ToolManager.cpp @@ -466,6 +466,10 @@ void ToolManager::Reset() { int ndx; + // The mInputMeter and mOutputMeter may be in use if audio is playing + // when this happens. + gAudioIO->SetMeters( NULL, NULL ); + // Disconnect all docked bars for( ndx = 0; ndx < ToolBarCount; ndx++ ) { @@ -513,7 +517,11 @@ void ToolManager::Reset() parent->Destroy(); } } - + // TODO:?? + // If audio was playing, we stopped the VU meters, + // It would be nice to show them again, but hardly essential as + // they will show up again on the next play. + // SetVUMeters(AudacityProject *p); LayoutToolBars(); Updated(); }