diff --git a/indra/llcommon/llinstancetracker.h b/indra/llcommon/llinstancetracker.h index 5a3990a8df58d8dcf4f40069af59f31cefc80452..34d841a4e01ddc58a383a1618f05185a4dfbdcd4 100644 --- a/indra/llcommon/llinstancetracker.h +++ b/indra/llcommon/llinstancetracker.h @@ -193,7 +193,12 @@ class LLInstanceTracker : public LLInstanceTrackerBase } protected: - LLInstanceTracker(KEY key) { add_(key); } + LLInstanceTracker(KEY key) + { + // make sure static data outlives all instances + getStatic(); + add_(key); + } virtual ~LLInstanceTracker() { // 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 protected: 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)); } virtual ~LLInstanceTracker()