diff options
author | Richard Linden <none@none> | 2013-05-02 19:38:35 -0700 |
---|---|---|
committer | Richard Linden <none@none> | 2013-05-02 19:38:35 -0700 |
commit | dd07e240538ae8eaed07526396069dae82448576 (patch) | |
tree | fc76e689adc32cdf55c5436c2e33507cbfee3f20 /indra | |
parent | 34403a6138922da2d97c24b8413e3693ab1d788f (diff) |
SH-4080 WIP interesting: random crash on Mac
added comments to llsingleton.h
Diffstat (limited to 'indra')
-rw-r--r-- | indra/llcommon/llsingleton.h | 5 |
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; }; |