Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't explode when we tear out the last tab of the window #15259

Conversation

zadjii-msft
Copy link
Member

If you were really fast, and closed one window, and then tried to drag the only tab out of the last remaining window, the Terminal could explode. It'd attempt to restore the previous window state, and explode.

Easy way to stop this (also, be more robust): just don't attempt to restore windows during tear-out. That's obvious.

This is a part of #14957

If you were really fast, and closed one window, and then tried to drag the only tab out of the last remaining window, the Terminal could explode. It'd attempt to restore the previous window state, and explode.

Easy way to stop this (also, be more robust): just don't attempt to restore windows during tear-out. That's obvious.

This is a part of #14957
@zadjii-msft zadjii-msft added Product-Terminal The new Windows Terminal. AutoMerge Marked for automatic merge by the bot when requirements are met zBugBash-Consider labels Apr 28, 2023
@microsoft-github-policy-service microsoft-github-policy-service bot enabled auto-merge (squash) April 28, 2023 15:21
@@ -220,7 +220,8 @@ void AppHost::_HandleCommandlineArgs(const Remoting::WindowRequestedArgs& window
// seemed to reorder bits of init so much that everything broke. So
// we'll leave it here.
const auto numPeasants = _windowManager.GetNumberOfPeasants();
if (numPeasants == 1)
// Don't attempt to session restore if we're just making a window for tear-out
if (!startedForContent && numPeasants == 1)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BTW I have to mention that this code is kind of... weird? I'm honestly not sure how to describe this feeling. Basically, I'm confused why session restore related code runs inside _HandleCommandlineArgs why it's related to numPeasants. And do we ever have more than 1 peasant nowadays? Not really asking, I'm just a lil puzzled about this code. I suppose that's how it feels like when reading AtlasEngine code for you all... 😄

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's super weird that's for sure. All of session restore sorta is. It probably could live in a helper just after _HandleCommandlineArgs. Might just make a PR for that for s&g's

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we may want to take a todo to really fine-toothed-comb this.

@@ -220,7 +220,8 @@ void AppHost::_HandleCommandlineArgs(const Remoting::WindowRequestedArgs& window
// seemed to reorder bits of init so much that everything broke. So
// we'll leave it here.
const auto numPeasants = _windowManager.GetNumberOfPeasants();
if (numPeasants == 1)
// Don't attempt to session restore if we're just making a window for tear-out
if (!startedForContent && numPeasants == 1)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we may want to take a todo to really fine-toothed-comb this.

@microsoft-github-policy-service microsoft-github-policy-service bot deleted the dev/migrie/b/dont-explode-when-last-tears-out branch April 28, 2023 23:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
AutoMerge Marked for automatic merge by the bot when requirements are met Product-Terminal The new Windows Terminal. zBugBash-Consider
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants