diff --git a/indra/llcommon/llinstancetracker.h b/indra/llcommon/llinstancetracker.h
index b0392900371a3d6f21c3622d06edf32b509abd97..fc51fbd2f99e1b6188bf6d00a53d14fd3163123a 100755
--- a/indra/llcommon/llinstancetracker.h
+++ b/indra/llcommon/llinstancetracker.h
@@ -38,6 +38,8 @@
 #include <boost/iterator/transform_iterator.hpp>
 #include <boost/iterator/indirect_iterator.hpp>
 
+#include "llerror.h"
+
 /**
  * Base class manages "class-static" data that must actually have singleton
  * semantics: one instance per process, rather than one instance per module as
@@ -305,6 +307,7 @@ class LLInstanceTracker<T, T*> : public LLInstanceTrackerBase
 	virtual ~LLInstanceTracker()
 	{
 		// it's unsafe to delete instances of this type while all instances are being iterated over.
+        llassert_always(getStatic().sIterationNestDepth == 0);
 		getSet_().erase(static_cast<T*>(this));
 	}