[PR #19088] Move ConPTY handoff logic into WindowEmperor #31702

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

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

State: closed
Merged: Yes


This changes the ConPTY handoff COM server from REGCLS_SINGLEUSE
to REGCLS_MULTIPLEUSE. The former causes a race condition, because
handoff runs concurrently with the creation of WinUI windows.
This can then result in the a window getting the wrong handoff.

It then moves the "root" of ConPTY handoff from TerminalPage
(WindowEmperor -> AppHost -> TerminalWindow -> TerminalPage)
into WindowEmperor (WindowEmperor).

Closes #19049

Validation Steps Performed

  • Launching cmd from the Start Menu shows a "Command Prompt" tab
  • Win+R -> cmd creates windows in the foreground
  • Win+R -> cmd /c start /max cmd creates a fullscreen tab
    • This even works for multiple windows, unlike with Canary
  • Win+R -> cmd /c start /min cmd does not work
    • It also doesn't work in Canary, so it's not a bug in this PR
**Original Pull Request:** https://github.com/microsoft/terminal/pull/19088 **State:** closed **Merged:** Yes --- This changes the ConPTY handoff COM server from `REGCLS_SINGLEUSE` to `REGCLS_MULTIPLEUSE`. The former causes a race condition, because handoff runs concurrently with the creation of WinUI windows. This can then result in the a window getting the wrong handoff. It then moves the "root" of ConPTY handoff from `TerminalPage` (WindowEmperor -> AppHost -> TerminalWindow -> TerminalPage) into `WindowEmperor` (WindowEmperor). Closes #19049 ## Validation Steps Performed * Launching cmd from the Start Menu shows a "Command Prompt" tab ✅ * Win+R -> `cmd` creates windows in the foreground ✅ * Win+R -> `cmd /c start /max cmd` creates a fullscreen tab ✅ * This even works for multiple windows, unlike with Canary ✅ * Win+R -> `cmd /c start /min cmd` does not work ❌ * It also doesn't work in Canary, so it's not a bug in this PR ✅
claunia added the pull-request label 2026-01-31 09:49:00 +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#31702