summaryrefslogtreecommitdiff
path: root/indra/llwindow
diff options
context:
space:
mode:
authorAnsariel <ansariel.hiller@phoenixviewer.com>2024-10-15 23:49:00 +0200
committerAndrey Lihatskiy <alihatskiy@productengine.com>2025-04-11 00:07:38 +0300
commitbab3bc4ebd8f33d80411d6d28e16eea6b865e8fd (patch)
tree8fa877a1984cb66d9ca7b7fbd42792573b017c58 /indra/llwindow
parenta510a1da004a9299d5389e77bb9aa43ae1cc1c60 (diff)
Fix more merge issues:
* Re-apply changes from a620e58daccf92b5b8d61347312739720ed2b51a * Fix duplicate code resulting from 826236f1bc065fba257d7954d11ac98c59493445 # Conflicts: # indra/llwindow/llwindowwin32.cpp
Diffstat (limited to 'indra/llwindow')
-rw-r--r--indra/llwindow/llwindowwin32.cpp44
1 files changed, 25 insertions, 19 deletions
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." <<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);
mGLReady = false;
- });
+ // Schedule destruction
+ HWND old_handle = mWindowHandleThrd;
mDeleteOnExit = true;
SetWindowLongPtr(old_handle, GWLP_USERDATA, NULL);