From c538254fbd77df962b627460d863911aa2196988 Mon Sep 17 00:00:00 2001 From: Mike Date: Thu, 8 Oct 2026 06:47:32 -0500 Subject: Do not recreate destroyed singletons during shutdown (#31) deleteAll() used to let getInstance() build a replacement, which crashed when the script-editor server posted a toast after LLUI was gone. Shutdown now refuses that construction, and notification adds do nothing once the notification system is gone. --- indra/llcommon/llsingleton.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'indra/llcommon/llsingleton.cpp') diff --git a/indra/llcommon/llsingleton.cpp b/indra/llcommon/llsingleton.cpp index 05dc3cde79..46659e6b7b 100644 --- a/indra/llcommon/llsingleton.cpp +++ b/indra/llcommon/llsingleton.cpp @@ -27,6 +27,8 @@ #include "linden_common.h" #include "llsingleton.h" +#include + #include "llerror.h" #include "llerrorcontrol.h" #include "lldependencies.h" @@ -406,8 +408,19 @@ void LLSingletonBase::cleanup_() } //static +namespace +{ + std::atomic sShuttingDown{false}; +} + +bool LLSingletonBase::shuttingDown() +{ + return sShuttingDown.load(std::memory_order_acquire); +} + void LLSingletonBase::deleteAll() { + sShuttingDown.store(true, std::memory_order_release); // It's essential to traverse these in dependency order. for (LLSingletonBase* sp : dep_sort()) { -- cgit v1.3