diff options
author | Logan Dethrow <log@lindenlab.com> | 2011-07-21 15:16:54 -0400 |
---|---|---|
committer | Logan Dethrow <log@lindenlab.com> | 2011-07-21 15:16:54 -0400 |
commit | 859dc52c30a8c750047323399caa4fec18adfb2d (patch) | |
tree | e90169de3ea558d1d856fa1a2417e83141cd7eaf /indra/llcommon | |
parent | 0f501293bdf5498369e5b6e4409cfdc758366d9e (diff) |
STORM-1112 Protected LLProxy members during cross-thread calls to LLProxy::applyProxySettings()
Diffstat (limited to 'indra/llcommon')
-rw-r--r-- | indra/llcommon/llsingleton.h | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/indra/llcommon/llsingleton.h b/indra/llcommon/llsingleton.h index 7aee1bb85f..00757be277 100644 --- a/indra/llcommon/llsingleton.h +++ b/indra/llcommon/llsingleton.h @@ -100,12 +100,6 @@ private: DELETED } EInitState; - static void deleteSingleton() - { - delete getData().mSingletonInstance; - getData().mSingletonInstance = NULL; - } - // stores pointer to singleton instance // and tracks initialization state of singleton struct SingletonInstanceData @@ -120,7 +114,11 @@ private: ~SingletonInstanceData() { - deleteSingleton(); + SingletonInstanceData& data = getData(); + if (data.mInitState != DELETED) + { + deleteSingleton(); + } } }; @@ -132,6 +130,14 @@ public: data.mInitState = DELETED; } + // Can be used to control when the singleton is deleted. Not normally needed. + static void deleteSingleton() + { + delete getData().mSingletonInstance; + getData().mSingletonInstance = NULL; + getData().mInitState = DELETED; + } + static SingletonInstanceData& getData() { // this is static to cache the lookup results |