Fix crash on macOS before the app starts.

This commit is contained in:
John Preston 2021-11-02 00:07:22 +04:00
parent eae6e4fc60
commit dab3bce8ba
1 changed files with 8 additions and 4 deletions

View File

@ -156,11 +156,15 @@ ApplicationDelegate *_sharedDelegate = nil;
}
- (BOOL) applicationShouldHandleReopen:(NSApplication *)theApplication hasVisibleWindows:(BOOL)flag {
if (const auto window = Core::App().activeWindow()) {
if (window->widget()->isHidden()) {
window->widget()->showFromTray();
Core::Sandbox::Instance().customEnterFromEventLoop([&] {
if (Core::IsAppLaunched()) {
if (const auto window = Core::App().activeWindow()) {
if (window->widget()->isHidden()) {
window->widget()->showFromTray();
}
}
}
}
});
return YES;
}