diff options
| author | Mike <contact@mikelittman.me> | 2026-10-08 06:47:32 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-10-08 19:47:32 +0800 |
| commit | c538254fbd77df962b627460d863911aa2196988 (patch) | |
| tree | 7ad27e28d217108acb12fb199492550e106c3ea5 /indra/llcommon/llsingleton.cpp | |
| parent | 55922ee44aad5824e9b18bba750ec06736c87e62 (diff) | |
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.
Diffstat (limited to 'indra/llcommon/llsingleton.cpp')
| -rw-r--r-- | indra/llcommon/llsingleton.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
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 <atomic> + #include "llerror.h" #include "llerrorcontrol.h" #include "lldependencies.h" @@ -406,8 +408,19 @@ void LLSingletonBase::cleanup_() } //static +namespace +{ + std::atomic<bool> 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()) { |
