diff --git a/src/AudacityApp.cpp b/src/AudacityApp.cpp index 1b3d3cd61..94f970f4f 100644 --- a/src/AudacityApp.cpp +++ b/src/AudacityApp.cpp @@ -1279,8 +1279,12 @@ bool AudacityApp::OnInit() // See CreateSingleInstanceChecker() where we send those paths over a // socket to the prior instance. using namespace std::chrono; + // This sleep may be unnecessary, but it is harmless. It less NS framework + // events arrive on another thread, but it might not always be long enough. std::this_thread::sleep_for(100ms); CallAfter([this]{ + // This call is what probably makes the sleep unnecessary: + MacFinishLaunching(); if (!InitPart2()) exit(-1); }); diff --git a/src/AudacityApp.h b/src/AudacityApp.h index 5c480194c..de84c5dc6 100644 --- a/src/AudacityApp.h +++ b/src/AudacityApp.h @@ -92,6 +92,7 @@ class AudacityApp final : public wxApp { #ifdef __WXMAC__ void MacActivateApp(); + void MacFinishLaunching(); #endif diff --git a/src/AudacityApp.mm b/src/AudacityApp.mm index 2dbe7e763..7de6987d6 100644 --- a/src/AudacityApp.mm +++ b/src/AudacityApp.mm @@ -4,7 +4,7 @@ #include -// One Mac-only method of class AudacityApp that uses Objective-C is kept +// Mac-only methods of class AudacityApp that use Objective-C are kept // here so that AudacityApp.cpp can be just C++ // The function is not presently used. See commit @@ -20,4 +20,9 @@ void AudacityApp::MacActivateApp() [app activateIgnoringOtherApps:YES]; } +void AudacityApp::MacFinishLaunching() +{ + [NSApp finishLaunching]; +} + #endif