[PR #11217] [MERGED] Make sure we fully clean up state when closing a peasant #28457

Open
opened 2026-01-31 09:28:39 +00:00 by claunia · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/microsoft/terminal/pull/11217
Author: @Rosefield
Created: 9/13/2021
Status: Merged
Merged: 9/14/2021
Merged by: @undefined

Base: mainHead: bug/gh11215-mru-peasant-hang


📝 Commits (2)

  • 05c1f50 Make sure we fully clean up state when closing a peasant
  • f786986 Add a test to make sure summon works when a window is SignalClosed instead of crashes.

📊 Changes

2 files changed (+142 additions, -0 deletions)

View changed files

📝 src/cascadia/Remoting/Monarch.cpp (+1 -0)
📝 src/cascadia/UnitTests_Remoting/RemotingTests.cpp (+141 -0)

📄 Description

Fix infinite loop when trying to summon a window after close.

In #10972 code was added to try to clean up state manually when a window
was closed instead of waiting for it to be detected as a dead peasant.
Unfortunately I didn't know any better and missed cleaning up
_mruPeasants as well. The result is there would be an infinite loop
in _getMostRecentPeasant since _getPeasant will only clean up ids if
it finds a peasant, not if it doesn't find anything. This is the minimal
change to get this working, but it might be a good idea to make
_getPeasant be more thorough about cleanup.

Validation Steps Performed

Tested that before the change we infinitely loop, and after the change
we summon correctly.

Closes #11215


🔄 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/microsoft/terminal/pull/11217 **Author:** [@Rosefield](https://github.com/Rosefield) **Created:** 9/13/2021 **Status:** ✅ Merged **Merged:** 9/14/2021 **Merged by:** [@undefined](undefined) **Base:** `main` ← **Head:** `bug/gh11215-mru-peasant-hang` --- ### 📝 Commits (2) - [`05c1f50`](https://github.com/microsoft/terminal/commit/05c1f5079b39818d85fd2458ae5c4e27b6622842) Make sure we fully clean up state when closing a peasant - [`f786986`](https://github.com/microsoft/terminal/commit/f78698686832eab53f172bb3b8e24e4226aead89) Add a test to make sure summon works when a window is SignalClosed instead of crashes. ### 📊 Changes **2 files changed** (+142 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `src/cascadia/Remoting/Monarch.cpp` (+1 -0) 📝 `src/cascadia/UnitTests_Remoting/RemotingTests.cpp` (+141 -0) </details> ### 📄 Description Fix infinite loop when trying to summon a window after close. In #10972 code was added to try to clean up state manually when a window was closed instead of waiting for it to be detected as a dead peasant. Unfortunately I didn't know any better and missed cleaning up `_mruPeasants` as well. The result is there would be an infinite loop in `_getMostRecentPeasant` since `_getPeasant` will only clean up ids if it finds a peasant, not if it doesn't find anything. This is the minimal change to get this working, but it might be a good idea to make `_getPeasant` be more thorough about cleanup. ## Validation Steps Performed Tested that before the change we infinitely loop, and after the change we summon correctly. Closes #11215 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
claunia added the pull-request label 2026-01-31 09:28:39 +00:00
Sign in to join this conversation.
No Label pull-request
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#28457