mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-05-15 14:16:07 -06:00
[PR #359] [MERGED] CtrlCore: Fix macOS Ide crash when closing app from dock. #342
Labels
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: github-starred/ultimatepp#342
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/ultimatepp/ultimatepp/pull/359
Author: @klugier
Created: 1/23/2026
Status: ✅ Merged
Merged: 1/23/2026
Merged by: @mirek-fidler
Base:
master← Head:klugier/macos-fix-crash-when-close-from-doc📝 Commits (2)
3b6e35eCtrlCore: Fix macOS Ide crash when closing app from doc.825c957.cosmetics📊 Changes
2 files changed (+10 additions, -2 deletions)
View changed files
📝
uppsrc/CtrlCore/CocoApp.mm(+5 -0)📝
uppsrc/CtrlCore/TopWindow.cpp(+5 -2)📄 Description
TheIDE currently crashes 80-90% of the time when closed via the dock while a main package is open. This instability stems from an unclean exit sequence, leading to undefined behavior during shutdown. To resolve this, we must intercept the system's terminate event and manage the lifecycle explicitly. Implementing a call to TopWindow::ShutdownWindows() within the close event handler ensures all resources are released properly and prevents the crash.
Regarding the following conditional logic:
Removing the IsEnabled() check is necessary to support scenarios with nested windows. For instance, if the 'Settings' dialog is open in TheIDE, the main application window is technically disabled. Retaining the IsEnabled() check would prevent the shutdown sequence from reaching the underlying windows, resulting in only the top-level active dialog being closed rather than the entire application. Not sure how it will be handled on other platforms...
Here is the close option that is causing problems...

I tested this solution on TheIDE and UWord (delete this in WhenClose logic!).
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.