From 4af7e496b489aaddea60453f40fd422ef5381a2d Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Sat, 3 Sep 2016 11:22:54 -0400 Subject: MAINT-5232: Make LLError::is_available() depend on both LLSingletons. LLError machinery depends on two different LLSingletons. Its is_available() function is primarily for LLSingleton itself to determine whether it is, or is not, safe to log. Until both of LLError's LLSingletons have been constructed, attempting to log LLSingleton operations could produce infinite recursion. --- indra/llcommon/llerror.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'indra') diff --git a/indra/llcommon/llerror.cpp b/indra/llcommon/llerror.cpp index 638cecb054..a34b50f816 100644 --- a/indra/llcommon/llerror.cpp +++ b/indra/llcommon/llerror.cpp @@ -414,11 +414,6 @@ namespace namespace LLError { - bool is_available() - { - return Globals::instanceExists(); - } - class SettingsConfig : public LLRefCount { friend class Settings; @@ -458,7 +453,7 @@ namespace LLError Settings(); SettingsConfigPtr getSettingsConfig(); - + void reset(); SettingsStoragePtr saveAndReset(); void restore(SettingsStoragePtr pSettingsStorage); @@ -466,7 +461,7 @@ namespace LLError private: SettingsConfigPtr mSettingsConfig; }; - + SettingsConfig::SettingsConfig() : LLRefCount(), mPrintLocation(false), @@ -501,26 +496,31 @@ namespace LLError { return mSettingsConfig; } - + void Settings::reset() { Globals::getInstance()->invalidateCallSites(); mSettingsConfig = new SettingsConfig(); } - + SettingsStoragePtr Settings::saveAndReset() { SettingsStoragePtr oldSettingsConfig(mSettingsConfig.get()); reset(); return oldSettingsConfig; } - + void Settings::restore(SettingsStoragePtr pSettingsStorage) { Globals::getInstance()->invalidateCallSites(); SettingsConfigPtr newSettingsConfig(dynamic_cast(pSettingsStorage.get())); mSettingsConfig = newSettingsConfig; } + + bool is_available() + { + return Settings::instanceExists() && Globals::instanceExists(); + } } namespace LLError -- cgit v1.2.3