summaryrefslogtreecommitdiff
path: root/indra/llcommon/llsingleton.h
diff options
context:
space:
mode:
authorDebi King (Dessie) <dessie@lindenlab.com>2011-08-29 12:23:28 -0400
committerDebi King (Dessie) <dessie@lindenlab.com>2011-08-29 12:23:28 -0400
commit5a39c44b56191a4ba516d3c504b3a0a574156e72 (patch)
treee95e5fc6cde0a046ac88abeba4a3410123cae890 /indra/llcommon/llsingleton.h
parentf5a890453b0a98636e6267b3272567ae0eecf1e4 (diff)
parent68a15f73c190d2a803ad8b11ed8d9b32bc9e46ee (diff)
merged .hgtags
Diffstat (limited to 'indra/llcommon/llsingleton.h')
-rw-r--r--indra/llcommon/llsingleton.h20
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