From 67ace0df9953ce3264048c3946720a9df492edfa Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Tue, 23 Nov 2021 20:48:44 -0500 Subject: SL-16400: Address a couple shutdown crashes. It can happen that we try to post() work for LLWindowWin32's window thread after the thread's WorkQueue has been closed. Also, instead of giving the "General" ThreadPool static lifespan, put it on the heap, anchored with a static unique_ptr. --- indra/llwindow/llwindowwin32.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'indra/llwindow') diff --git a/indra/llwindow/llwindowwin32.cpp b/indra/llwindow/llwindowwin32.cpp index af7b8d91f0..7f8f88a749 100644 --- a/indra/llwindow/llwindowwin32.cpp +++ b/indra/llwindow/llwindowwin32.cpp @@ -351,7 +351,15 @@ struct LLWindowWin32::LLWindowWin32Thread : public LL::ThreadPool template void post(CALLABLE&& func) { - getQueue().post(std::forward(func)); + try + { + getQueue().post(std::forward(func)); + } + catch (const LLThreadSafeQueueInterrupt&) + { + // Shutdown timing is tricky. The main thread can end up trying + // to post a cursor position after having closed the WorkQueue. + } } /** -- cgit v1.2.3