summaryrefslogtreecommitdiff
path: root/indra/llcommon
diff options
context:
space:
mode:
authorRichard Linden <none@none>2013-04-26 11:21:16 -0700
committerRichard Linden <none@none>2013-04-26 11:21:16 -0700
commit81291381f876e7a2c01889ddc3d849d88520af41 (patch)
tree954ab5e162ed21578022ed50b16d52091e8e82ff /indra/llcommon
parent1a01542e22a7c602b4e2733a42d933600c5e6609 (diff)
SH-4080 WIP interesting: random crash on Mac
fixed Mac crash related to non-reentrant singleton constructor
Diffstat (limited to 'indra/llcommon')
-rw-r--r--indra/llcommon/llsingleton.h9
1 files changed, 8 insertions, 1 deletions
diff --git a/indra/llcommon/llsingleton.h b/indra/llcommon/llsingleton.h
index 1cbefb1cd0..165344ed19 100644
--- a/indra/llcommon/llsingleton.h
+++ b/indra/llcommon/llsingleton.h
@@ -83,8 +83,10 @@ private:
void construct()
{
+ sReentrantConstructorGuard = true;
mSingletonInstance = new DERIVED_TYPE();
mInitState = INITIALIZING;
+ sReentrantConstructorGuard = false;
}
~SingletonInstanceData()
@@ -174,7 +176,7 @@ public:
// Use this to avoid accessing singletons before the can safely be constructed
static bool instanceExists()
{
- return getSingletonData().mInitState == INITIALIZED;
+ return sReentrantConstructorGuard || getSingletonData().mInitState == INITIALIZED;
}
// Has this singleton already been deleted?
@@ -194,6 +196,11 @@ private:
}
virtual void initSingleton() {}
+
+ static bool sReentrantConstructorGuard;
};
+template<typename T>
+bool LLSingleton<T>::sReentrantConstructorGuard = false;
+
#endif