Skip to content
Snippets Groups Projects
Commit 4af7e496 authored by Nat Goodspeed's avatar Nat Goodspeed
Browse files

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.
parent a05ee732
No related branches found
No related tags found
No related merge requests found
...@@ -414,11 +414,6 @@ namespace ...@@ -414,11 +414,6 @@ namespace
namespace LLError namespace LLError
{ {
bool is_available()
{
return Globals::instanceExists();
}
class SettingsConfig : public LLRefCount class SettingsConfig : public LLRefCount
{ {
friend class Settings; friend class Settings;
...@@ -458,7 +453,7 @@ namespace LLError ...@@ -458,7 +453,7 @@ namespace LLError
Settings(); Settings();
SettingsConfigPtr getSettingsConfig(); SettingsConfigPtr getSettingsConfig();
void reset(); void reset();
SettingsStoragePtr saveAndReset(); SettingsStoragePtr saveAndReset();
void restore(SettingsStoragePtr pSettingsStorage); void restore(SettingsStoragePtr pSettingsStorage);
...@@ -466,7 +461,7 @@ namespace LLError ...@@ -466,7 +461,7 @@ namespace LLError
private: private:
SettingsConfigPtr mSettingsConfig; SettingsConfigPtr mSettingsConfig;
}; };
SettingsConfig::SettingsConfig() SettingsConfig::SettingsConfig()
: LLRefCount(), : LLRefCount(),
mPrintLocation(false), mPrintLocation(false),
...@@ -501,26 +496,31 @@ namespace LLError ...@@ -501,26 +496,31 @@ namespace LLError
{ {
return mSettingsConfig; return mSettingsConfig;
} }
void Settings::reset() void Settings::reset()
{ {
Globals::getInstance()->invalidateCallSites(); Globals::getInstance()->invalidateCallSites();
mSettingsConfig = new SettingsConfig(); mSettingsConfig = new SettingsConfig();
} }
SettingsStoragePtr Settings::saveAndReset() SettingsStoragePtr Settings::saveAndReset()
{ {
SettingsStoragePtr oldSettingsConfig(mSettingsConfig.get()); SettingsStoragePtr oldSettingsConfig(mSettingsConfig.get());
reset(); reset();
return oldSettingsConfig; return oldSettingsConfig;
} }
void Settings::restore(SettingsStoragePtr pSettingsStorage) void Settings::restore(SettingsStoragePtr pSettingsStorage)
{ {
Globals::getInstance()->invalidateCallSites(); Globals::getInstance()->invalidateCallSites();
SettingsConfigPtr newSettingsConfig(dynamic_cast<SettingsConfig *>(pSettingsStorage.get())); SettingsConfigPtr newSettingsConfig(dynamic_cast<SettingsConfig *>(pSettingsStorage.get()));
mSettingsConfig = newSettingsConfig; mSettingsConfig = newSettingsConfig;
} }
bool is_available()
{
return Settings::instanceExists() && Globals::instanceExists();
}
} }
namespace LLError namespace LLError
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment