From 94eeef729e14a452aaa952f2864b0a426727ced7 Mon Sep 17 00:00:00 2001
From: andreykproductengine <andreykproductengine@lindenlab.com>
Date: Tue, 4 Sep 2018 20:19:48 +0300
Subject: [PATCH] MAINT-9082 crash on HandleFocusLost

---
 indra/llwindow/llwindowwin32.cpp | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/indra/llwindow/llwindowwin32.cpp b/indra/llwindow/llwindowwin32.cpp
index cbda906599d..4ee4a5357c5 100644
--- a/indra/llwindow/llwindowwin32.cpp
+++ b/indra/llwindow/llwindowwin32.cpp
@@ -752,8 +752,6 @@ void LLWindowWin32::close()
 
 	mDragDrop->reset();
 
-	// Make sure cursor is visible and we haven't mangled the clipping state.
-	setMouseClipping(FALSE);
 
 	// Go back to screen mode written in the registry.
 	if (mFullscreen)
@@ -763,13 +761,13 @@ void LLWindowWin32::close()
 
 	// Don't process events in our mainWindowProc any longer.
 	SetWindowLongPtr(mWindowHandle, GWLP_USERDATA, NULL);
-	if (mCallbacks)
-	{
-		mCallbacks->handleFocusLost(this);
-	}
-	else
+
+	// Make sure cursor is visible and we haven't mangled the clipping state.
+	showCursor();
+	setMouseClipping(FALSE);
+	if (gKeyboard)
 	{
-		showCursor();
+		gKeyboard->resetKeys();
 	}
 
 	// Clean up remaining GL state
-- 
GitLab