Some code review

This commit is contained in:
Schuyler Rosefield 2021-09-09 19:53:38 -04:00
parent 91f18453bf
commit e386d6f6c7
2 changed files with 8 additions and 6 deletions

View file

@ -171,13 +171,12 @@ namespace winrt::Microsoft::Terminal::Remoting::implementation
const auto peasantSearch = _peasants.find(_ourPeasantId);
if (peasantSearch != _peasants.end())
{
const auto p = peasantSearch->second;
p.Quit();
peasantSearch->second.Quit();
}
else
{
// Somehow we don't have our own peasant, but we are trying to quit
// so just blow up.
// Somehow we don't have our own peasant, this should never happen.
// We are trying to quit anyways so just fail here.
FAIL_FAST();
}
}

View file

@ -325,8 +325,11 @@ namespace winrt::Microsoft::Terminal::Remoting::implementation
TraceLoggingKeyword(TIL_KEYWORD_TRACE));
// If the peasant asks us to quit we should not try to act in future elections.
_peasant.QuitRequested([this](auto&&, auto&&) {
_monarchWaitInterrupt.SetEvent();
_peasant.QuitRequested([weakThis{ get_weak() }](auto&&, auto&&) {
if (auto wm = weakThis.get())
{
wm._monarchWaitInterrupt.SetEvent();
}
});
return _peasant;