Relax locking around the swapchain (#5225)

The terminal lock is really only for the terminal; since the renderer is
fully owned by the control, not the Terminal, and we'll only be
receiving swap chain events after we register them during
initialization, we don't need to lock before _or_ after firing off the
coroutine.

Fixes #5203.
This commit is contained in:
Dustin L. Howett (MSFT) 2020-04-06 17:15:31 -07:00 committed by GitHub
parent 38803d7d05
commit e44dc2bcf8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -484,14 +484,9 @@ namespace winrt::Microsoft::Terminal::TerminalControl::implementation
winrt::fire_and_forget TermControl::RenderEngineSwapChainChanged()
{
{ // lock scope
auto terminalLock = _terminal->LockForReading();
if (!_initializedTerminal)
{
return;
}
}
// This event is only registered during terminal initialization,
// so we don't need to check _initializedTerminal.
// We also don't lock for things that come back from the renderer.
auto chain = _renderEngine->GetSwapChain();
auto weakThis{ get_weak() };
@ -499,8 +494,6 @@ namespace winrt::Microsoft::Terminal::TerminalControl::implementation
if (auto control{ weakThis.get() })
{
auto terminalLock = _terminal->LockForWriting();
_AttachDxgiSwapChainToXaml(chain.Get());
}
}