From 01317a2faded53c79db7e0814426f1d8b2fd12fc Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Tue, 30 Nov 2021 15:22:26 -0500 Subject: SL-16421: Destroy the "General" ThreadPool as soon as cleanup starts. Introduce LLAppViewer::onCleanup(), a method that accepts a nullary callable to execute once viewer shutdown begins. Fire the collected callables in LLAppViewer::cleanup(). In llstartup.cpp, instead of declaring a static unique_ptr and relying on static object destruction to clean up the "General" ThreadPool, bind the pointer to the new ThreadPool into an onCleanup() lambda that will delete it when called. ~ThreadPool() takes care of orderly shutdown. --- indra/newview/llappviewer.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'indra/newview/llappviewer.cpp') diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 529db397b2..a5d32ba243 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -1729,6 +1729,11 @@ void LLAppViewer::flushVFSIO() bool LLAppViewer::cleanup() { + // Since we don't know what functions are going to be queued by + // onCleanup(), we have to assume they might rely on some of the things + // we're about to destroy below. Run them first. + mOnCleanup(); + LLAtmosphere::cleanupClass(); //ditch LLVOAvatarSelf instance -- cgit v1.2.3