Skip to content
Snippets Groups Projects
Commit 525eb6ba authored by Richard Nelson's avatar Richard Nelson
Browse files
parents 69cad254 3b4f4d34
No related branches found
No related tags found
No related merge requests found
...@@ -193,7 +193,12 @@ class LLInstanceTracker : public LLInstanceTrackerBase ...@@ -193,7 +193,12 @@ class LLInstanceTracker : public LLInstanceTrackerBase
} }
protected: protected:
LLInstanceTracker(KEY key) { add_(key); } LLInstanceTracker(KEY key)
{
// make sure static data outlives all instances
getStatic();
add_(key);
}
virtual ~LLInstanceTracker() virtual ~LLInstanceTracker()
{ {
// it's unsafe to delete instances of this type while all instances are being iterated over. // it's unsafe to delete instances of this type while all instances are being iterated over.
...@@ -281,7 +286,8 @@ class LLInstanceTracker<T, T*> : public LLInstanceTrackerBase ...@@ -281,7 +286,8 @@ class LLInstanceTracker<T, T*> : public LLInstanceTrackerBase
protected: protected:
LLInstanceTracker() LLInstanceTracker()
{ {
// it's safe but unpredictable to create instances of this type while all instances are being iterated over. I hate unpredictable. This assert will probably be turned on early in the next development cycle. // make sure static data outlives all instances
getStatic();
getSet_().insert(static_cast<T*>(this)); getSet_().insert(static_cast<T*>(this));
} }
virtual ~LLInstanceTracker() virtual ~LLInstanceTracker()
......
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