From d6fb30538fef20eeda9d31e09c68e763967a9d99 Mon Sep 17 00:00:00 2001 From: James Crook Date: Sat, 9 Jul 2016 22:36:48 +0100 Subject: [PATCH] Bug 1377 - Crash after Audacity starts and low disk space warning appears Very low risk workaround implemented - close and dispose of the splash screen before creating project. It is pretty clear it is the interaction between two dialogs during AppInit that is the root cause of the problem. A high risk solution would involve delving into and fixing wx3 internals. Splash screen will now disappear fractionally sooner than before - the time it takes to create an empty project. --- src/AudacityApp.cpp | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/src/AudacityApp.cpp b/src/AudacityApp.cpp index 6588ae6d0..ac839a250 100644 --- a/src/AudacityApp.cpp +++ b/src/AudacityApp.cpp @@ -1172,6 +1172,9 @@ AudacityApp::~AudacityApp() // main frame bool AudacityApp::OnInit() { + // JKC: ANSWER-ME: Who actually added the event loop guarantor? + // Although 'blame' says Leland, I think it came from a donated patch. + // Ensure we have an event loop during initialization wxEventLoopGuarantor eventLoop; @@ -1420,6 +1423,9 @@ bool AudacityApp::OnInit() wxSTAY_ON_TOP); temporarywindow.SetTitle(_("Audacity is starting up...")); SetTopWindow(&temporarywindow); + + // ANSWER-ME: Why is YieldFor needed at all? + //wxEventLoopBase::GetActive()->YieldFor(wxEVT_CATEGORY_UI|wxEVT_CATEGORY_USER_INPUT|wxEVT_CATEGORY_UNKNOWN); wxEventLoopBase::GetActive()->YieldFor(wxEVT_CATEGORY_UI); //JKC: Would like to put module loading here. @@ -1457,7 +1463,18 @@ bool AudacityApp::OnInit() SetExitOnFrameDelete(false); #endif //__WXMAC__ + temporarywindow.Show(false); + } + // Workaround Bug 1377 - Crash after Audacity starts and low disk space warning appears + // The temporary splash window is closed AND cleaned up, before attempting to create + // a project and possibly creating a modal warning dialog by doing so. + // Also fixes problem of warning being obscured. + // Downside is that we have no splash screen for the (brief) time that we spend + // creating the project. + // Root cause is problem with wxSplashScreen and other dialogs co-existing, that + // seemed to arrive with wx3. + { project = CreateNewAudacityProject(); mCmdHandler->SetProject(project); wxWindow * pWnd = MakeHijackPanel(); @@ -1468,8 +1485,6 @@ bool AudacityApp::OnInit() SetTopWindow(pWnd); pWnd->Show(true); } - - temporarywindow.Show(false); } if( project->mShowSplashScreen )