Skip to content

Commit ef283da

Browse files
tusharsnxDHowett
authored andcommitted
Fix single-tab window tear-off crash (#17251)
## Validation Steps Performed - Opened multi-tab terminal window with Narrator. Narrator can read characters from the tabs. - Started a drag and drop (tear-off) of a tab, and it didn't crash. This was repeated multiple times. (cherry picked from commit 30ef1f4) Service-Card-Id: 92546869 Service-Version: 1.21
1 parent 18c3f72 commit ef283da

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/cascadia/TerminalControl/TermControl.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1055,8 +1055,11 @@ namespace winrt::Microsoft::Terminal::Control::implementation
10551055
// MSFT 33353327: We're purposefully not using _initializedTerminal to ensure we're fully initialized.
10561056
// Doing so makes us return nullptr when XAML requests an automation peer.
10571057
// Instead, we need to give XAML an automation peer, then fix it later.
1058-
if (!_IsClosing())
1058+
if (!_IsClosing() && !_detached)
10591059
{
1060+
// It's unexpected that interactivity is null even when we're not closing or in detached state.
1061+
THROW_HR_IF_NULL(E_UNEXPECTED, _interactivity);
1062+
10601063
// create a custom automation peer with this code pattern:
10611064
// (https://docs.microsoft.com/en-us/windows/uwp/design/accessibility/custom-automation-peers)
10621065
if (const auto& interactivityAutoPeer{ _interactivity.OnCreateAutomationPeer() })

0 commit comments

Comments
 (0)