1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-07-22 07:28:03 +02:00

Bug1561: delay the recovery dialog until after application init

This commit is contained in:
Paul Licameli 2016-12-19 17:56:52 -05:00
parent f4a5805ae6
commit 426cb9c40c

@ -1367,7 +1367,7 @@ bool AudacityApp::OnInit()
// Parse command line and handle options that might require // Parse command line and handle options that might require
// immediate exit...no need to initialize all of the audio // immediate exit...no need to initialize all of the audio
// stuff to display the version string. // stuff to display the version string.
auto parser = ParseCommandLine(); std::shared_ptr< wxCmdLineParser > parser{ ParseCommandLine().release() };
if (!parser) if (!parser)
{ {
// Either user requested help or a parsing error occured // Either user requested help or a parsing error occured
@ -1506,38 +1506,41 @@ bool AudacityApp::OnInit()
Importer::Get().Initialize(); Importer::Get().Initialize();
// // Bug1561: delay the recovery dialog, to avoid crashes.
// Auto-recovery CallAfter( [=] () mutable {
// //
bool didRecoverAnything = false; // Auto-recovery
if (!ShowAutoRecoveryDialogIfNeeded(&project, &didRecoverAnything)) //
{ bool didRecoverAnything = false;
// Important: Prevent deleting any temporary files! if (!ShowAutoRecoveryDialogIfNeeded(&project, &didRecoverAnything))
DirManager::SetDontDeleteTempFiles();
QuitAudacity(true);
return false;
}
//
// Remainder of command line parsing, but only if we didn't recover
//
if (!didRecoverAnything)
{
if (parser->Found(wxT("t")))
{ {
RunBenchmark(NULL); // Important: Prevent deleting any temporary files!
DirManager::SetDontDeleteTempFiles();
QuitAudacity(true);
return false; return false;
} }
// As of wx3, there's no need to process the filename arguments as they //
// will be sent view the MacOpenFile() method. // Remainder of command line parsing, but only if we didn't recover
#if !defined(__WXMAC__) //
for (size_t i = 0, cnt = parser->GetParamCount(); i < cnt; i++) if (!didRecoverAnything)
{ {
MRUOpen(parser->GetParam(i)); if (parser->Found(wxT("t")))
} {
RunBenchmark(NULL);
return false;
}
// As of wx3, there's no need to process the filename arguments as they
// will be sent view the MacOpenFile() method.
#if !defined(__WXMAC__)
for (size_t i = 0, cnt = parser->GetParamCount(); i < cnt; i++)
{
MRUOpen(parser->GetParam(i));
}
#endif #endif
} }
} );
gInited = true; gInited = true;