Skip to content

Commit 2c5018d

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: 92546868 Service-Version: 1.20
1 parent 0cc5194 commit 2c5018d

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/cascadia/TerminalControl/TermControl.cpp

+4-1
Original file line numberDiff line numberDiff line change
@@ -940,8 +940,11 @@ namespace winrt::Microsoft::Terminal::Control::implementation
940940
// MSFT 33353327: We're purposefully not using _initializedTerminal to ensure we're fully initialized.
941941
// Doing so makes us return nullptr when XAML requests an automation peer.
942942
// Instead, we need to give XAML an automation peer, then fix it later.
943-
if (!_IsClosing())
943+
if (!_IsClosing() && !_detached)
944944
{
945+
// It's unexpected that interactivity is null even when we're not closing or in detached state.
946+
THROW_HR_IF_NULL(E_UNEXPECTED, _interactivity);
947+
945948
// create a custom automation peer with this code pattern:
946949
// (https://docs.microsoft.com/en-us/windows/uwp/design/accessibility/custom-automation-peers)
947950
if (const auto& interactivityAutoPeer{ _interactivity.OnCreateAutomationPeer() })

0 commit comments

Comments
 (0)