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.

This commit is contained in:
james.k.crook@gmail.com 2011-05-03 12:00:45 +00:00
parent 352cca2c59
commit 6cc4b04784
2 changed files with 13 additions and 2 deletions

View File

@ -281,7 +281,10 @@ ScreenFrame::ScreenFrame(wxWindow * parent, wxWindowID id)
Populate(); 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(); mContext.proj->mToolManager->Reset();
} }

View File

@ -466,6 +466,10 @@ void ToolManager::Reset()
{ {
int ndx; 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 // Disconnect all docked bars
for( ndx = 0; ndx < ToolBarCount; ndx++ ) for( ndx = 0; ndx < ToolBarCount; ndx++ )
{ {
@ -513,7 +517,11 @@ void ToolManager::Reset()
parent->Destroy(); 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(); LayoutToolBars();
Updated(); Updated();
} }