diff options
author | Erik Kundiman <erik@megapahit.org> | 2025-08-21 06:33:49 +0800 |
---|---|---|
committer | Erik Kundiman <erik@megapahit.org> | 2025-08-21 06:33:49 +0800 |
commit | b3e00b61a9126a54383cc52c356d0c488d2ec91d (patch) | |
tree | 487b6aa41fbf524fbf0d6eead502424d6cc33d0b /indra/llwindow/llwindowwin32.cpp | |
parent | 2d8948ef173c5bfc37834301f4aa4fb72e78f03c (diff) | |
parent | 143de1ddbf4489c490d16cc8cbf0eca688a81b43 (diff) |
Merge tag 'Second_Life_Release#143de1dd-2025.06' into 2025.06
Diffstat (limited to 'indra/llwindow/llwindowwin32.cpp')
-rw-r--r-- | indra/llwindow/llwindowwin32.cpp | 50 |
1 files changed, 21 insertions, 29 deletions
diff --git a/indra/llwindow/llwindowwin32.cpp b/indra/llwindow/llwindowwin32.cpp index e4ab73563b..03cc10e5d6 100644 --- a/indra/llwindow/llwindowwin32.cpp +++ b/indra/llwindow/llwindowwin32.cpp @@ -1002,7 +1002,7 @@ void LLWindowWin32::close() // Restore gamma to the system values. restoreGamma(); - LL_INFOS("Window") << "Destroying Window Thread" << LL_ENDL; + LL_INFOS("Window") << "Cleanup and destruction of Window Thread" << LL_ENDL; if (sWindowHandleForMessageBox == mWindowHandle) { @@ -4897,17 +4897,7 @@ bool LLWindowWin32::LLWindowWin32Thread::wakeAndDestroy() return false; } - // Hide the window immediately to prevent user interaction during shutdown - if (mWindowHandleThrd) - { - ShowWindow(mWindowHandleThrd, SW_HIDE); - } - else - { - LL_WARNS("Window") << "Tried to hide window, but Win32 window handle is NULL." << LL_ENDL; - return false; - } - + // Stop checking budget mGLReady = false; // Capture current handle before we lose it @@ -4922,24 +4912,10 @@ bool LLWindowWin32::LLWindowWin32Thread::wakeAndDestroy() // Signal thread to clean up when done mDeleteOnExit = true; - // Close the queue first - LL_DEBUGS("Window") << "Closing window's pool queue" << LL_ENDL; - mQueue->close(); - - // Wake up the thread if it's stuck in GetMessage() - if (old_handle) - { - WPARAM wparam{ 0xB0B0 }; - LL_DEBUGS("Window") << "PostMessage(" << std::hex << old_handle - << ", " << WM_DUMMY_ - << ", " << wparam << ")" << std::dec << LL_ENDL; - - // Use PostMessage to signal thread to wake up - PostMessage(old_handle, WM_DUMMY_, wparam, 0x1337); - } - + LL_INFOS("Window") << "Detaching window's thread" << LL_ENDL; // Cleanly detach threads instead of joining them to avoid blocking the main thread // This is acceptable since the thread will self-delete with mDeleteOnExit + // Doing it before close() to make sure thread doesn't die before or mid detach. for (auto& pair : mThreads) { try { @@ -4954,7 +4930,23 @@ bool LLWindowWin32::LLWindowWin32Thread::wakeAndDestroy() } } - LL_DEBUGS("Window") << "thread pool shutdown complete" << LL_ENDL; + // Close the queue. + LL_INFOS("Window") << "Closing window's pool queue" << LL_ENDL; + mQueue->close(); + + // Wake up the thread if it's stuck in GetMessage() + if (old_handle) + { + WPARAM wparam{ 0xB0B0 }; + LL_DEBUGS("Window") << "PostMessage(" << std::hex << old_handle + << ", " << WM_DUMMY_ + << ", " << wparam << ")" << std::dec << LL_ENDL; + + // Use PostMessage to signal thread to wake up + PostMessage(old_handle, WM_DUMMY_, wparam, 0x1337); + } + + LL_INFOS("Window") << "Thread pool shutdown complete" << LL_ENDL; return true; } |