Skip to content
Snippets Groups Projects
Commit 81291381 authored by Richard Linden's avatar Richard Linden
Browse files

SH-4080 WIP interesting: random crash on Mac

fixed Mac crash related to non-reentrant singleton constructor
parent 1a01542e
No related branches found
No related tags found
No related merge requests found
......@@ -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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment