[PR #16575] Use TerminateProcess to exit early #30949

Closed
opened 2026-01-31 09:44:01 +00:00 by claunia · 0 comments
Owner

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

State: closed
Merged: Yes


Closes MSFT:46744208

BODGY: If the emperor is being dtor'd, it's because we've gone past the
end of main, and released the ref in main. Then we might run into an
edge case where main releases it's ref to the emperor, but one of the
window threads might be in the process of exiting, and still holding a
strong ref to the emperor. In that case, we can actually end up with
the window thread being the last reference, and calling App::Close
on that thread will crash us with a E_WRONG_THREAD.

This fixes the issue calling TerminateProcess explicitly.

How validated: The ES team manually ran the test pass this was
crashing in a hundred times to make sure this actually fixed it.

Co-authored-by: Leonard Hecker lhecker@microsoft.com

**Original Pull Request:** https://github.com/microsoft/terminal/pull/16575 **State:** closed **Merged:** Yes --- Closes MSFT:46744208 BODGY: If the emperor is being dtor'd, it's because we've gone past the end of main, and released the ref in main. Then we might run into an edge case where main releases it's ref to the emperor, but one of the window threads might be in the process of exiting, and still holding a strong ref to the emperor. In that case, we can actually end up with the _window thread_ being the last reference, and calling App::Close on that thread will crash us with a E_WRONG_THREAD. This fixes the issue calling `TerminateProcess` explicitly. How validated: The ES team manually ran the test pass this was crashing in a hundred times to make sure this actually fixed it. Co-authored-by: Leonard Hecker <lhecker@microsoft.com>
claunia added the pull-request label 2026-01-31 09:44:01 +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#30949