From bab3bc4ebd8f33d80411d6d28e16eea6b865e8fd Mon Sep 17 00:00:00 2001 From: Ansariel Date: Tue, 15 Oct 2024 23:49:00 +0200 Subject: Fix more merge issues: * Re-apply changes from a620e58daccf92b5b8d61347312739720ed2b51a * Fix duplicate code resulting from 826236f1bc065fba257d7954d11ac98c59493445 # Conflicts: # indra/llwindow/llwindowwin32.cpp --- indra/llwindow/llwindowwin32.cpp | 44 +++++++++++++++++++++++----------------- indra/newview/llvoavatar.cpp | 1 - 2 files changed, 25 insertions(+), 20 deletions(-) (limited to 'indra') diff --git a/indra/llwindow/llwindowwin32.cpp b/indra/llwindow/llwindowwin32.cpp index 6fad11d506..3ef162a870 100644 --- a/indra/llwindow/llwindowwin32.cpp +++ b/indra/llwindow/llwindowwin32.cpp @@ -351,6 +351,10 @@ struct LLWindowWin32::LLWindowWin32Thread : public LL::ThreadPool void run() override; + // Detroys handles and window + // Either post to or call from window thread + void destroyWindow(); + // Closes queue, wakes thread, waits until thread closes. // Call from main thread bool wakeAndDestroy(); @@ -410,7 +414,7 @@ struct LLWindowWin32::LLWindowWin32Thread : public LL::ThreadPool // until after some graphics setup. See SL-20177. -Cosmic,2023-09-18 bool mGLReady = false; bool mGotGLBuffer = false; - bool mDeleteOnExit = false; + LLAtomicBool mDeleteOnExit = false; }; @@ -4802,30 +4806,17 @@ void LLWindowWin32::LLWindowWin32Thread::run() #endif } + destroyWindow(); + if (mDeleteOnExit) { delete this; } } -bool LLWindowWin32::LLWindowWin32Thread::wakeAndDestroy() +void LLWindowWin32::LLWindowWin32Thread::destroyWindow() { - if (mQueue->isClosed()) - { - LL_WARNS() << "Tried to close Queue. Win32 thread Queue already closed." << LL_ENDL; - return false; - } - - // Make sure we don't leave a blank toolbar button. - // Also hiding window now prevents user from suspending it - // via some action (like dragging it around) - ShowWindow(mWindowHandleThrd, SW_HIDE); - - // Schedule destruction - HWND old_handle = mWindowHandleThrd; - post([this]() - { - if (IsWindow(mWindowHandleThrd)) + if (mWindowHandleThrd != NULL && IsWindow(mWindowHandleThrd)) { if (mhDCThrd) { @@ -4849,9 +4840,24 @@ bool LLWindowWin32::LLWindowWin32Thread::wakeAndDestroy() } mWindowHandleThrd = NULL; mhDCThrd = NULL; +} + +bool LLWindowWin32::LLWindowWin32Thread::wakeAndDestroy() +{ + if (mQueue->isClosed()) + { + LL_WARNS() << "Tried to close Queue. Win32 thread Queue already closed." <