Skip to content

Fix: Prevent crash during Mudlet shutdown when closing profiles#8606

Merged
vadi2 merged 1 commit intoMudlet:developmentfrom
mpconley:fix/tcommandline-crash-7478
Dec 5, 2025
Merged

Fix: Prevent crash during Mudlet shutdown when closing profiles#8606
vadi2 merged 1 commit intoMudlet:developmentfrom
mpconley:fix/tcommandline-crash-7478

Conversation

@mpconley
Copy link
Copy Markdown
Contributor

@mpconley mpconley commented Dec 2, 2025

Brief overview of PR changes/additions

Added safety checks to prevent accessing command line tracking during Host shutdown. The fix adds mIsClosingDown checks to three Host methods that manage the command line focus stack.

Motivation for adding to Mudlet

Mudlet was crashing with a segmentation fault when shutting down, especially when closing multiple profiles. The crash occurred because focus events were still trying to update command line tracking while the Host object was being destroyed, leading to access of invalid memory.

Other info (issues closed, discussion etc)

@mpconley mpconley requested a review from a team as a code owner December 2, 2025 02:14
@add-deployment-links
Copy link
Copy Markdown

add-deployment-links bot commented Dec 2, 2025

Hey there! Thanks for helping Mudlet improve. 🌟

Test versions

You can directly test the changes here:

No need to install anything - just unzip and run.
Let us know if it works well, and if it doesn't, please give details.

@vadi2 vadi2 merged commit adba266 into Mudlet:development Dec 5, 2025
12 checks passed
vadi2 pushed a commit that referenced this pull request Dec 6, 2025
#### Brief overview of PR changes/additions

Added safety checks to prevent accessing command line tracking during
Host shutdown. The fix adds `mIsClosingDown` checks to three Host
methods that manage the command line focus stack.

#### Motivation for adding to Mudlet

Mudlet was crashing with a segmentation fault when shutting down,
especially when closing multiple profiles. The crash occurred because
focus events were still trying to update command line tracking while the
Host object was being destroyed, leading to access of invalid memory.

#### Other info (issues closed, discussion etc)

- Fixes #7478
- Crash was happening in `Host::recordActiveCommandLine()` during
shutdown
- Added protection to `recordActiveCommandLine()`,
`forgetCommandLine()`, and `activeCommandLine()` methods
- Tested successfully - Mudlet now shuts down cleanly without crashes

(cherry picked from commit adba266)
@vadi2
Copy link
Copy Markdown
Member

vadi2 commented Dec 6, 2025

Cherry-picked into release-4.20 branch.

@mpconley mpconley deleted the fix/tcommandline-crash-7478 branch December 17, 2025 20:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Crash on Mudlet exit when closing multiple profiles at once

2 participants