Skip to content

Commit

Permalink
Don't let a window be created with the literal name "new"
Browse files Browse the repository at this point in the history
As on the tin.

Blocking for 1.18.

Tracked in #14957
  • Loading branch information
zadjii-msft committed May 10, 2023
1 parent 4dd9493 commit 98d2d32
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/cascadia/Remoting/Monarch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,10 @@ namespace winrt::Microsoft::Terminal::Remoting::implementation
{
return 0;
}
if (name == L"new")
{
return 0;
}

uint64_t result = 0;

Expand Down Expand Up @@ -1106,8 +1110,9 @@ namespace winrt::Microsoft::Terminal::Remoting::implementation
// In the case where window couldn't be found, then create a window
// for that name / ID.
//
// Don't let the window literally be named "-1", because that's silly
auto request = winrt::make_self<implementation::WindowRequestedArgs>(window == L"-1" ? L"" : window,
// Don't let the window literally be named "-1", because that's silly. Same with "new"
const bool nameIsReserved = window == L"-1" || window == L"new";
auto request = winrt::make_self<implementation::WindowRequestedArgs>(nameIsReserved ? L"" : window,
content,
windowBounds);
_RequestNewWindowHandlers(*this, *request);
Expand Down

0 comments on commit 98d2d32

Please sign in to comment.