Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/cascadia/TerminalControl/ControlCore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2306,9 +2306,16 @@ namespace winrt::Microsoft::Terminal::Control::implementation
void ControlCore::DetachUiaEngine(::Microsoft::Console::Render::UiaEngine* const pEngine)
{
const auto lock = _terminal->LockForWriting();
LOG_IF_FAILED(pEngine->Disable());
_renderer->RemoveRenderEngine(pEngine);
}

HRESULT ControlCore::DisableUiaEngine(::Microsoft::Console::Render::UiaEngine* const pEngine)
{
const auto lock = _terminal->LockForWriting();
return pEngine->Disable();
}

bool ControlCore::IsInReadOnlyMode() const
{
return _isReadOnly;
Expand Down
1 change: 1 addition & 0 deletions src/cascadia/TerminalControl/ControlCore.h
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation

void AttachUiaEngine(::Microsoft::Console::Render::UiaEngine* const pEngine);
void DetachUiaEngine(::Microsoft::Console::Render::UiaEngine* const pEngine);
[[nodiscard]] HRESULT DisableUiaEngine(::Microsoft::Console::Render::UiaEngine* const pEngine);

bool IsInReadOnlyMode() const;
void ToggleReadOnlyMode();
Expand Down
13 changes: 4 additions & 9 deletions src/cascadia/TerminalControl/ControlInteractivity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,14 +76,9 @@ namespace winrt::Microsoft::Terminal::Control::implementation
// and the UIA engine will try to dispatch to the
// TermControlAutomationPeer, which (is now)/(will very soon be) gone.
//
// To alleviate, make sure to disable the UIA engine and remove it,
// and ALSO disable the renderer. Core.Detach will take care of the
// TriggerTeardown (which will stop the renderer
// after all current engines are done painting).
//
// Simply disabling the UIA engine is not enough, because it's
// possible that it had already started presenting here.
LOG_IF_FAILED(_uiaEngine->Disable());
// To alleviate, core will both disable the UIA engine and remove it,
// Core.Detach will take care of the TriggerTeardown (which will stop
// the renderer after all current engines are done painting).
_core->DetachUiaEngine(_uiaEngine.get());
}
_core->Detach();
Expand Down Expand Up @@ -198,7 +193,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation

if (_uiaEngine.get())
{
THROW_IF_FAILED(_uiaEngine->Disable());
THROW_IF_FAILED(_core->DisableUiaEngine(_uiaEngine.get()));
}

_core->LostFocus();
Expand Down