diff options
author | andreykproductengine <andreykproductengine@lindenlab.com> | 2018-08-14 18:32:59 +0300 |
---|---|---|
committer | andreykproductengine <andreykproductengine@lindenlab.com> | 2018-08-14 18:32:59 +0300 |
commit | 9f16d10f6d4c423f0e723e7c1f5805c461b2da10 (patch) | |
tree | 6b5d5bbd8dc23896a05cb9628fa1fabfc6781984 | |
parent | 961d7933f5da61f7802d83db1b6c4ed190096c75 (diff) |
MAINT-5651 Crashes on close from LLWindowWin32
-rw-r--r-- | indra/llwindow/llwindowwin32.cpp | 29 |
1 files changed, 21 insertions, 8 deletions
diff --git a/indra/llwindow/llwindowwin32.cpp b/indra/llwindow/llwindowwin32.cpp index f98c2423e5..cbda906599 100644 --- a/indra/llwindow/llwindowwin32.cpp +++ b/indra/llwindow/llwindowwin32.cpp @@ -754,7 +754,6 @@ void LLWindowWin32::close() // Make sure cursor is visible and we haven't mangled the clipping state. setMouseClipping(FALSE); - showCursor(); // Go back to screen mode written in the registry. if (mFullscreen) @@ -762,9 +761,23 @@ void LLWindowWin32::close() resetDisplayResolution(); } + // Don't process events in our mainWindowProc any longer. + SetWindowLongPtr(mWindowHandle, GWLP_USERDATA, NULL); + if (mCallbacks) + { + mCallbacks->handleFocusLost(this); + } + else + { + showCursor(); + } + // Clean up remaining GL state - LL_DEBUGS("Window") << "Shutting down GL" << LL_ENDL; - gGLManager.shutdownGL(); + if (gGLManager.mInited) + { + LL_INFOS("Window") << "Cleaning up GL" << LL_ENDL; + gGLManager.shutdownGL(); + } LL_DEBUGS("Window") << "Releasing Context" << LL_ENDL; if (mhRC) @@ -785,16 +798,16 @@ void LLWindowWin32::close() // Restore gamma to the system values. restoreGamma(); - if (mhDC && !ReleaseDC(mWindowHandle, mhDC)) + if (mhDC) { - LL_WARNS("Window") << "Release of ghDC failed" << LL_ENDL; + if (!ReleaseDC(mWindowHandle, mhDC)) + { + LL_WARNS("Window") << "Release of ghDC failed" << LL_ENDL; + } mhDC = NULL; } LL_DEBUGS("Window") << "Destroying Window" << LL_ENDL; - - // Don't process events in our mainWindowProc any longer. - SetWindowLongPtr(mWindowHandle, GWLP_USERDATA, NULL); // Make sure we don't leave a blank toolbar button. ShowWindow(mWindowHandle, SW_HIDE); |