Fix wt -w _quake by not throwing when setting the window name (#15030)

If we get initialized with a window name, this will be called before
XAML is stood up, and constructing a PropertyChangedEventArgs will
throw. So don't.


Regressed in #14843 

Related to #5000, #14957
This commit is contained in:
Mike Griese
2023-03-24 08:30:37 -05:00
committed by GitHub
parent f06cd1759f
commit b34444f40a

View File

@@ -1155,6 +1155,10 @@ namespace winrt::TerminalApp::implementation
{
const auto oldIsQuakeMode = _WindowProperties->IsQuakeWindow();
_WindowProperties->WindowName(name);
if (!_root)
{
return;
}
const auto newIsQuakeMode = _WindowProperties->IsQuakeWindow();
if (newIsQuakeMode != oldIsQuakeMode)
{
@@ -1210,8 +1214,15 @@ namespace winrt::TerminalApp::implementation
if (_WindowName != value)
{
_WindowName = value;
_PropertyChangedHandlers(*this, Windows::UI::Xaml::Data::PropertyChangedEventArgs{ L"WindowName" });
_PropertyChangedHandlers(*this, Windows::UI::Xaml::Data::PropertyChangedEventArgs{ L"WindowNameForDisplay" });
// If we get initialized with a window name, this will be called
// before XAML is stood up, and constructing a
// PropertyChangedEventArgs will throw.
try
{
_PropertyChangedHandlers(*this, Windows::UI::Xaml::Data::PropertyChangedEventArgs{ L"WindowName" });
_PropertyChangedHandlers(*this, Windows::UI::Xaml::Data::PropertyChangedEventArgs{ L"WindowNameForDisplay" });
}
CATCH_LOG();
}
}
uint64_t WindowProperties::WindowId() const noexcept