aboutsummaryrefslogtreecommitdiff
path: root/mp/src/public/tier1/utlrbtree.h
diff options
context:
space:
mode:
Diffstat (limited to 'mp/src/public/tier1/utlrbtree.h')
-rw-r--r--mp/src/public/tier1/utlrbtree.h7
1 files changed, 5 insertions, 2 deletions
diff --git a/mp/src/public/tier1/utlrbtree.h b/mp/src/public/tier1/utlrbtree.h
index 273ee958..ded22bf5 100644
--- a/mp/src/public/tier1/utlrbtree.h
+++ b/mp/src/public/tier1/utlrbtree.h
@@ -1150,6 +1150,11 @@ void CUtlRBTree<T, I, L, M>::RemoveAll()
// Clear everything else out
m_Root = InvalidIndex();
+ // Technically, this iterator could become invalid. It will not, because it's
+ // always the same iterator. If we don't clear this here, the state of this
+ // container will be invalid after we start inserting elements again.
+ m_LastAlloc = m_Elements.InvalidIterator();
+ m_FirstFree = InvalidIndex();
m_NumElements = 0;
Assert( IsValid() );
@@ -1163,9 +1168,7 @@ template < class T, class I, typename L, class M >
void CUtlRBTree<T, I, L, M>::Purge()
{
RemoveAll();
- m_FirstFree = InvalidIndex();
m_Elements.Purge();
- m_LastAlloc = m_Elements.InvalidIterator();
}