From 073132a8bd7e7ea0cc9131569ce709a748e6446a Mon Sep 17 00:00:00 2001 From: James Holderness Date: Thu, 5 Aug 2021 03:04:31 +0100 Subject: [PATCH] Don't access the alt buffer after it has been deleted. --- src/host/screenInfo.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/host/screenInfo.cpp b/src/host/screenInfo.cpp index 2506bf4506b..5323cb57414 100644 --- a/src/host/screenInfo.cpp +++ b/src/host/screenInfo.cpp @@ -2002,8 +2002,6 @@ void SCREEN_INFORMATION::UseMainScreenBuffer() SCREEN_INFORMATION* psiAlt = psiMain->_psiAlternateBuffer; psiMain->_psiAlternateBuffer = nullptr; - s_RemoveScreenBuffer(psiAlt); // this will also delete the alt buffer - // deleting the alt buffer will give the GetSet back to its main // Copy the alt buffer's cursor style and visibility back to the main buffer. const auto& altCursor = psiAlt->GetTextBuffer().GetCursor(); @@ -2012,6 +2010,9 @@ void SCREEN_INFORMATION::UseMainScreenBuffer() mainCursor.SetIsVisible(altCursor.IsVisible()); mainCursor.SetBlinkingAllowed(altCursor.IsBlinkingAllowed()); + s_RemoveScreenBuffer(psiAlt); // this will also delete the alt buffer + // deleting the alt buffer will give the GetSet back to its main + // Tell the VT MouseInput handler that we're in the main buffer now gci.GetActiveInputBuffer()->GetTerminalInput().UseMainScreenBuffer(); }