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 on session restore #16998

Merged
merged 1 commit into from
Apr 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion src/cascadia/TerminalControl/TermControl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2276,7 +2276,18 @@ namespace winrt::Microsoft::Terminal::Control::implementation

void TermControl::PersistToPath(const winrt::hstring& path) const
{
winrt::get_self<ControlCore>(_core)->PersistToPath(path.c_str());
// Don't persist us if we weren't ever initialized. In that case, we
// never got an initial size, never instantiated a buffer, and didn't
// start the connection yet, so there's nothing for us to add here.
//
// If we were supposed to be restored from a path, then we don't need to
// do anything special here. We'll leave the original file untouched,
// and the next time we actually are initialized, we'll just use that
// file then.
if (_initializedTerminal)
{
winrt::get_self<ControlCore>(_core)->PersistToPath(path.c_str());
}
}

void TermControl::Close()
Expand Down
Loading