From 2378455f481a11d327b477b1472d92e129186b82 Mon Sep 17 00:00:00 2001 From: Rye Mutt <rye@alchemyviewer.org> Date: Mon, 10 Aug 2020 22:53:19 -0400 Subject: [PATCH] Cleanup/fix SDL2 shutdown --- indra/llwindow/llwindowsdl.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/indra/llwindow/llwindowsdl.cpp b/indra/llwindow/llwindowsdl.cpp index 11a371bfd3d..563b6018230 100644 --- a/indra/llwindow/llwindowsdl.cpp +++ b/indra/llwindow/llwindowsdl.cpp @@ -669,6 +669,7 @@ BOOL LLWindowSDL::createContext(int x, int y, int width, int height, int bits, B LL_WARNS() << "OpenGL context creation failure. SDL: " << SDL_GetError() << LL_ENDL; setupFailure("Context creation error", "Error", OSMB_OK); SDL_DestroyWindow(mWindow); + mWindow = nullptr; return FALSE; } if (SDL_GL_MakeCurrent(mWindow, mGLContext) != 0) @@ -845,12 +846,20 @@ void LLWindowSDL::destroyContext() LL_INFOS() << "shutdownGL begins" << LL_ENDL; gGLManager.shutdownGL(); - mWindow = NULL; + LL_INFOS() << "Destroying SDL cursors" << LL_ENDL; + quitCursors(); + + LL_INFOS() << "Destroying GL Context" << LL_ENDL; + SDL_GL_DeleteContext(mGLContext); + mGLContext = nullptr; + + LL_INFOS() << "Destroying SDL Window" << LL_ENDL; + SDL_DestroyWindow(mWindow); + mWindow = nullptr; } LLWindowSDL::~LLWindowSDL() { - quitCursors(); destroyContext(); if(mSupportedResolutions != NULL) @@ -907,7 +916,6 @@ void LLWindowSDL::close() setMouseClipping(FALSE); showCursor(); - quitCursors(); destroyContext(); } -- GitLab