Skip to content

Commit

Permalink
Fix wt -w _quake by not throwing when setting the window name (#15030)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
zadjii-msft authored Mar 24, 2023
1 parent f06cd17 commit b34444f
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/cascadia/TerminalApp/TerminalWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit b34444f

Please sign in to comment.