From 57e040070c03397ae0396e39348be6691c5f939a Mon Sep 17 00:00:00 2001 From: Paul Licameli Date: Fri, 21 Jul 2017 01:39:13 -0400 Subject: [PATCH] Bug1627: Fix infinite recursion of error dialogs, failing start scrub --- src/toolbars/ControlToolBar.cpp | 7 +++++++ src/tracks/ui/Scrubbing.cpp | 8 ++++++++ 2 files changed, 15 insertions(+) diff --git a/src/toolbars/ControlToolBar.cpp b/src/toolbars/ControlToolBar.cpp index 98310cf53..fd851c324 100644 --- a/src/toolbars/ControlToolBar.cpp +++ b/src/toolbars/ControlToolBar.cpp @@ -709,10 +709,17 @@ int ControlToolBar::PlayPlayRegion(const SelectedRegion &selectedRegion, #endif } else { + // Bug1627 (part of it): + // infinite error spew when trying to start scrub: + // Problem was that the error dialog yields to events, + // causing recursion to this function in the scrub timer + // handler! Easy fix, just delay the user alert instead. + CallAfter( [=]{ // Show error message if stream could not be opened ShowErrorDialog(this, _("Error"), _("Error opening sound device.\nTry changing the audio host, playback device and the project sample rate."), wxT("http://manual.audacityteam.org/man/faq_errors.html#sound_device"), false); + }); } } diff --git a/src/tracks/ui/Scrubbing.cpp b/src/tracks/ui/Scrubbing.cpp index c1e19dfd3..17a0c32d9 100644 --- a/src/tracks/ui/Scrubbing.cpp +++ b/src/tracks/ui/Scrubbing.cpp @@ -421,6 +421,14 @@ bool Scrubber::MaybeStartScrubbing(wxCoord xx) mPoller->Start(ScrubPollInterval_ms); } + else if (mScrubToken <= 0) { + // Bug1627 (part of it): + // infinite error spew when trying to start scrub: + // If failed for reasons of audio device problems, do not try + // again with repeated timer ticks. + mScrubStartPosition = -1; + return false; + } // Return true whether we started scrub, or are still waiting to decide. return true;