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

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

Original Pull Request: https://github.com/microsoft/terminal/pull/11217

State: closed
Merged: Yes


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

**Original Pull Request:** https://github.com/microsoft/terminal/pull/11217 **State:** closed **Merged:** Yes --- 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
claunia added the pull-request label 2026-01-31 09:28:40 +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#28462