mirror of
https://github.com/cookiengineer/audacity
synced 2025-06-15 15:49:36 +02:00
regarding bug 9:
Was able to make the bug occur after lots of fast clicking around, by double-clicking Preview in Amplify dialog. The key seems to be the call to wxYield. That function is obsolete, but looking at the documentation for its successor, wxApp::Yield(): "Caution should be exercised, however, since yielding may allow the user to perform actions which are not compatible with the current task. Disabling menu items or whole menus during processing can avoid unwanted reentrance of code: see ::wxSafeYield for a better function." That sounds like exactly the situations where this has occurred. And the documentation for ::wxSafeYieldsays: "This function is similar to wxYield, except that it disables the user input to all program windows before calling wxYield and re-enables it again afterwards." Sounds like what we need. So I went through the code and for all the wxYield and wxGetApp()::Yield occurrences where Audacity is doing some drawing or already in the process of responding to a GUI event, I replaced them with ::wxSafeYield. Replaced all the remaining wxYield calls with calls to wxGetApp()::Yield(). Haven't been able to replicate the bug since these changes. Please test.
This commit is contained in:
parent
6ebd7f4716
commit
54bd928ef6
@ -66,7 +66,7 @@ void NonGuiThread::RunInThread(tGenericFn pFn)
|
||||
{
|
||||
wxMilliSleep( 100 );
|
||||
//traits->AlwaysYield();
|
||||
wxYield();
|
||||
wxGetApp().Yield();
|
||||
}
|
||||
#ifdef WXMSW
|
||||
traits->AfterChildWaitLoop(cookie);
|
||||
|
@ -377,7 +377,7 @@ AudioIO::~AudioIO()
|
||||
|
||||
/* Delete is a "graceful" way to stop the thread.
|
||||
(Kill is the not-graceful way.) */
|
||||
wxYield();
|
||||
wxGetApp().Yield();
|
||||
mThread->Delete();
|
||||
|
||||
if(mSilentBuf)
|
||||
@ -1233,7 +1233,7 @@ void AudioIO::StopStream()
|
||||
// if it was already there.
|
||||
mUpdateMeters = false;
|
||||
while(mUpdatingMeters) {
|
||||
wxYield();
|
||||
::wxSafeYield();
|
||||
wxMilliSleep( 50 );
|
||||
}
|
||||
|
||||
@ -1295,7 +1295,7 @@ void AudioIO::StopStream()
|
||||
while( mAudioThreadShouldCallFillBuffersOnce == true )
|
||||
{
|
||||
// LLL: Experienced recursive yield here...once.
|
||||
wxGetApp().Yield( true );
|
||||
wxGetApp().Yield(true); // Pass true for onlyIfNeeded to avoid recursive call error.
|
||||
wxMilliSleep( 50 );
|
||||
}
|
||||
|
||||
|
@ -367,7 +367,7 @@ void BenchmarkDialog::OnRun( wxCommandEvent &event )
|
||||
|
||||
Printf(wxT("Preparing...\n"));
|
||||
|
||||
wxYield();
|
||||
wxGetApp().Yield();
|
||||
FlushPrint();
|
||||
|
||||
int i, b, v;
|
||||
@ -400,7 +400,7 @@ void BenchmarkDialog::OnRun( wxCommandEvent &event )
|
||||
//t->Debug();
|
||||
|
||||
Printf(wxT("Performing %d edits...\n"), trials);
|
||||
wxYield();
|
||||
wxGetApp().Yield();
|
||||
FlushPrint();
|
||||
|
||||
timer.Start();
|
||||
@ -454,7 +454,7 @@ void BenchmarkDialog::OnRun( wxCommandEvent &event )
|
||||
}
|
||||
Printf(wxT("Time to perform %d edits: %ld ms\n"), trials, elapsed);
|
||||
FlushPrint();
|
||||
wxYield();
|
||||
wxGetApp().Yield();
|
||||
|
||||
|
||||
#if 0
|
||||
@ -466,7 +466,7 @@ void BenchmarkDialog::OnRun( wxCommandEvent &event )
|
||||
|
||||
Printf(wxT("Doing correctness check...\n"));
|
||||
FlushPrint();
|
||||
wxYield();
|
||||
wxGetApp().Yield();
|
||||
|
||||
bad = 0;
|
||||
timer.Start();
|
||||
@ -491,7 +491,7 @@ void BenchmarkDialog::OnRun( wxCommandEvent &event )
|
||||
Printf(wxT("Time to check all data: %ld ms\n"), elapsed);
|
||||
Printf(wxT("Reading data again...\n"));
|
||||
|
||||
wxYield();
|
||||
wxGetApp().Yield();
|
||||
FlushPrint();
|
||||
|
||||
timer.Start();
|
||||
|
@ -68,7 +68,7 @@ static void main_do_event(GdkEvent *event, wxArrayPtrVoid *queue)
|
||||
CaptureEvents::CaptureEvents()
|
||||
{
|
||||
#if wxUSE_LOG
|
||||
// disable log flushing from here because a call to wxYield() shouldn't
|
||||
// disable log flushing from here because a call to wxGetApp().Yield() shouldn't
|
||||
// normally result in message boxes popping up &c
|
||||
wxLog::Suspend();
|
||||
#endif
|
||||
|
@ -116,7 +116,7 @@ bool MixAndRender(TrackList *tracks, TrackFactory *trackFactory,
|
||||
startTime, endTime, mono ? 1 : 2, maxBlockLen, false,
|
||||
rate, format);
|
||||
|
||||
wxYield();
|
||||
::wxSafeYield();
|
||||
ProgressDialog *progress = new ProgressDialog(_("Mix and Render"),
|
||||
_("Mixing and rendering tracks"));
|
||||
|
||||
|
@ -413,7 +413,7 @@ int ExportCL::Export(AudacityProject *project,
|
||||
// Wait for process to terminate
|
||||
while (p->IsActive()) {
|
||||
wxMilliSleep(10);
|
||||
wxYield();
|
||||
wxGetApp().Yield();
|
||||
}
|
||||
|
||||
// Display output on error or if the user wants to see it
|
||||
|
@ -514,7 +514,7 @@ void ExpandingToolBar::StartMoving()
|
||||
// This gives time for wx to finish redrawing the window that way.
|
||||
// HACK: why do we need to do it so many times???
|
||||
for(j=0; j<500; j++)
|
||||
wxYield();
|
||||
::wxSafeYield();
|
||||
|
||||
wxBitmap toolbarBitmap = GetToolbarBitmap();
|
||||
|
||||
@ -551,7 +551,7 @@ void ExpandingToolBar::StartMoving()
|
||||
// This gives time for wx to finish redrawing the window that way.
|
||||
// HACK: why do we need to do it several times???
|
||||
for(j=0; j<500; j++)
|
||||
wxYield();
|
||||
::wxSafeYield();
|
||||
|
||||
mAreaParent->SetCapturedChild(this);
|
||||
|
||||
@ -607,7 +607,7 @@ void ExpandingToolBar::UpdateMoving()
|
||||
// This gives time for wx to finish redrawing the window that way.
|
||||
// HACK: why do we need to do it so many times???
|
||||
for(i=0; i<500; i++)
|
||||
wxYield();
|
||||
::wxSafeYield();
|
||||
|
||||
mDragImage->Show();
|
||||
mDragImage->Move(ScreenToClient(wxGetMousePosition()));
|
||||
|
Loading…
x
Reference in New Issue
Block a user