CtrlCore: Fix macOS Ide crash when closing app from dock. (#359)

This commit is contained in:
Zbigniew Rębacz 2026-01-23 17:50:35 +01:00 committed by GitHub
parent 8ff90f3d3f
commit 0ac083d53d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 10 additions and 2 deletions

View file

@ -45,6 +45,11 @@ NSMenu *Cocoa_DockMenu();
Upp::Ctrl::PostReSkin();
}
- (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender {
Upp::GuiLock __;
Upp::TopWindow::ShutdownWindows();
return NSTerminateCancel;
}
@end

View file

@ -500,12 +500,15 @@ void TopWindow::ShutdownWindows()
again = false;
for(int i = 0; i < tc.GetCount(); i++) {
Ptr<TopWindow> w = dynamic_cast<TopWindow *>(tc[i]);
if(w && w->IsOpen() && w->IsEnabled()) {
if(w && w->IsOpen()) {
again = true;
w->SetForeground();
w->ShutdownWindow();
if(w && w->IsOpen())
if(w && w->IsOpen()) {
w->WhenClose();
if(w)
w->Close();
}
if(!w || !w->IsOpen())
break;
}