summaryrefslogtreecommitdiff
path: root/indra/llcommon
diff options
context:
space:
mode:
authorRichard Linden <none@none>2013-05-06 09:37:37 -0700
committerRichard Linden <none@none>2013-05-06 09:37:37 -0700
commit71ec63a70a23f8be46ac22d57eb73fdcbae2aaa2 (patch)
treed105dc62e378ceaf9ec463857d63fe31c8c5b715 /indra/llcommon
parent6b81b8629e67d82a7620e48781ded73b6e6126ea (diff)
parentdd07e240538ae8eaed07526396069dae82448576 (diff)
Automated merge with ssh://hg.lindenlab.com/richard/viewer-interesting
Diffstat (limited to 'indra/llcommon')
-rw-r--r--indra/llcommon/llsingleton.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/indra/llcommon/llsingleton.h b/indra/llcommon/llsingleton.h
index 40002313f1..1e87d9bd7b 100644
--- a/indra/llcommon/llsingleton.h
+++ b/indra/llcommon/llsingleton.h
@@ -143,6 +143,8 @@ public:
case INITIALIZING:
// go ahead and flag ourselves as initialized so we can be reentrant during initialization
sData.mInitState = INITIALIZED;
+ // initialize singleton after constructing it so that it can reference other singletons which in turn depend on it,
+ // thus breaking cyclic dependencies
sData.mInstance->initSingleton();
return sData.mInstance;
case INITIALIZED:
@@ -150,6 +152,7 @@ public:
case DELETED:
llwarns << "Trying to access deleted singleton " << typeid(DERIVED_TYPE).name() << " creating new instance" << llendl;
SingletonLifetimeManager::construct();
+ // same as first time construction
sData.mInitState = INITIALIZED;
sData.mInstance->initSingleton();
return sData.mInstance;
@@ -190,6 +193,8 @@ private:
struct SingletonData
{
+ // explicitly has a default constructor so that member variables are zero initialized in BSS
+ // and only changed by singleton logic, not constructor running during startup
EInitState mInitState;
DERIVED_TYPE* mInstance;
};