[PR #15161] [MERGED] Register the GetWindowLayoutRequested handler only when ready #30463

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

📋 Pull Request Information

Original PR: https://github.com/microsoft/terminal/pull/15161
Author: @zadjii-msft
Created: 4/11/2023
Status: Merged
Merged: 4/12/2023
Merged by: @zadjii-msft

Base: mainHead: dev/migrie/b/this-was-the-danthom-thing


📝 Commits (2)

  • e7a5e9a Register the GetWindowLayoutRequested handler only when ready
  • 7997d7f I maintain that's a coding word but whatever

📊 Changes

1 file changed (+17 additions, -7 deletions)

View changed files

📝 src/cascadia/WindowsTerminal/AppHost.cpp (+17 -7)

📄 Description

Moves our GetWindowLayoutRequested handler AFTER the xaml island is started. The AppHost::_GetWindowLayoutAsync handler requires us to be able to work on our UI thread, which requires that we have a Dispatcher ready for us to move to. If we set up this callback in the ctor, then it is possible for there to be a time slice where

  • the monarch creates the peasant for us,
  • we get ctor'ed (registering the callback)
  • then the monarch attempts to query all peasants for their layout, coming back to ask us even before XAML has been created.

I believe this was the source of the crash that was reported in a mail thread. It actually happened to me once while debugging another branch. Alas, this was realy hard to hit in the first place, so I'm not totally certain this fixes it.

Related to #14957


🔄 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/15161 **Author:** [@zadjii-msft](https://github.com/zadjii-msft) **Created:** 4/11/2023 **Status:** ✅ Merged **Merged:** 4/12/2023 **Merged by:** [@zadjii-msft](https://github.com/zadjii-msft) **Base:** `main` ← **Head:** `dev/migrie/b/this-was-the-danthom-thing` --- ### 📝 Commits (2) - [`e7a5e9a`](https://github.com/microsoft/terminal/commit/e7a5e9acd94125f56d83211e90a989809660ec37) Register the GetWindowLayoutRequested handler only when ready - [`7997d7f`](https://github.com/microsoft/terminal/commit/7997d7f3a3f8798d409338d35f6dcc666d9b10f3) I maintain that's a coding word but whatever ### 📊 Changes **1 file changed** (+17 additions, -7 deletions) <details> <summary>View changed files</summary> 📝 `src/cascadia/WindowsTerminal/AppHost.cpp` (+17 -7) </details> ### 📄 Description Moves our `GetWindowLayoutRequested` handler AFTER the xaml island is started. The `AppHost::_GetWindowLayoutAsync` handler requires us to be able to work on our UI thread, which requires that we have a `Dispatcher` ready for us to move to. If we set up this callback in the ctor, then it is possible for there to be a time slice where * the monarch creates the peasant for us, * we get ctor'ed (registering the callback) * then the monarch attempts to query all _peasants_ for their layout, coming back to ask us even before XAML has been created. I believe this was the source of the crash that was reported in a mail thread. It actually happened to me once while debugging another branch. Alas, this was realy hard to hit in the first place, so I'm not _totally_ certain this fixes it. Related to #14957 --- <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:40:57 +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#30463