[PR #359] [MERGED] CtrlCore: Fix macOS Ide crash when closing app from dock. #342

Closed
opened 2026-05-05 03:46:14 -06:00 by gitea-mirror · 0 comments
Owner

📋 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: masterHead: klugier/macos-fix-crash-when-close-from-doc


📝 Commits (2)

  • 3b6e35e CtrlCore: 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:

if(w && w->IsOpen() && w->IsEnabled()) {

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...
Zrzut ekranu 2026-01-23 o 16 59 06

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.

## 📋 Pull Request Information **Original PR:** https://github.com/ultimatepp/ultimatepp/pull/359 **Author:** [@klugier](https://github.com/klugier) **Created:** 1/23/2026 **Status:** ✅ Merged **Merged:** 1/23/2026 **Merged by:** [@mirek-fidler](https://github.com/mirek-fidler) **Base:** `master` ← **Head:** `klugier/macos-fix-crash-when-close-from-doc` --- ### 📝 Commits (2) - [`3b6e35e`](https://github.com/ultimatepp/ultimatepp/commit/3b6e35e73a9848c2a6897f1bb1e3940ca92cb969) CtrlCore: Fix macOS Ide crash when closing app from doc. - [`825c957`](https://github.com/ultimatepp/ultimatepp/commit/825c95764a3a7c7455691385536f29e5f0ce3c58) .cosmetics ### 📊 Changes **2 files changed** (+10 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `uppsrc/CtrlCore/CocoApp.mm` (+5 -0) 📝 `uppsrc/CtrlCore/TopWindow.cpp` (+5 -2) </details> ### 📄 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: ``` if(w && w->IsOpen() && w->IsEnabled()) { ``` 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... <img width="196" height="259" alt="Zrzut ekranu 2026-01-23 o 16 59 06" src="https://github.com/user-attachments/assets/7d076523-9dcb-4716-badc-3469a267241f" /> I tested this solution on TheIDE and UWord (delete this in WhenClose logic!). --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
gitea-mirror 2026-05-05 03:46:14 -06:00
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: github-starred/ultimatepp#342
No description provided.