diff options
author | Rye Cogtail <rye@lindenlab.com> | 2024-09-29 03:17:43 -0400 |
---|---|---|
committer | Erik Kundiman <erik@megapahit.org> | 2025-05-28 22:44:20 +0800 |
commit | 300e52d800112fab9f0137d067e9117bb2f9bba8 (patch) | |
tree | 7e186c0c8f787fc9b89414beabdede65913c5e4f | |
parent | 022b013955b9bd6bfadc0262ce82821f4611e77c (diff) |
Fix shutdown crash from failing to clean up SDL window properly
-rw-r--r-- | indra/llwindow/llwindowsdl.cpp | 41 |
1 files changed, 34 insertions, 7 deletions
diff --git a/indra/llwindow/llwindowsdl.cpp b/indra/llwindow/llwindowsdl.cpp index 4ca4fc6001..982f10503e 100644 --- a/indra/llwindow/llwindowsdl.cpp +++ b/indra/llwindow/llwindowsdl.cpp @@ -765,7 +765,13 @@ void LLWindowSDL::destroyContext() { LL_INFOS() << "destroyContext begins" << LL_ENDL; + // Stop unicode input SDL_StopTextInput(); + + // Clean up remaining GL state before blowing away window + LL_INFOS() << "shutdownGL begins" << LL_ENDL; + gGLManager.shutdownGL(); + #if LL_X11 mSDL_Display = NULL; mSDL_XWindowID = None; @@ -773,18 +779,38 @@ void LLWindowSDL::destroyContext() Unlock_Display = NULL; #endif // LL_X11 - // Clean up remaining GL state before blowing away window - LL_INFOS() << "shutdownGL begins" << LL_ENDL; - gGLManager.shutdownGL(); + LL_INFOS() << "Destroying SDL cursors" << LL_ENDL; + quitCursors(); + + if (mContext) + { + LL_INFOS() << "Destroying SDL GL Context" << LL_ENDL; + SDL_GL_DeleteContext(mContext); + mContext = nullptr; + } + else + { + LL_INFOS() << "SDL GL Context already destroyed" << LL_ENDL; + } + + if (mWindow) + { + LL_INFOS() << "Destroying SDL Window" << LL_ENDL; + SDL_DestroyWindow(mWindow); + mWindow = nullptr; + } + else + { + LL_INFOS() << "SDL Window already destroyed" << LL_ENDL; + } + LL_INFOS() << "destroyContext end" << LL_ENDL; + LL_INFOS() << "SDL_QuitSS/VID begins" << LL_ENDL; SDL_QuitSubSystem(SDL_INIT_VIDEO); // *FIX: this might be risky... - - mWindow = NULL; } LLWindowSDL::~LLWindowSDL() { - quitCursors(); destroyContext(); if(mSupportedResolutions != NULL) @@ -999,8 +1025,9 @@ void LLWindowSDL::swapBuffers() { if (mWindow) { - SDL_GL_SwapWindow( mWindow ); + SDL_GL_SwapWindow(mWindow); } + LL_PROFILER_GPU_COLLECT; } U32 LLWindowSDL::getFSAASamples() |