// Destructor UtlHashMapIterator::~UtlHashMapIterator() { UtlContainer::acquireIteratorConnectionLock(); OsLock take(mContainerRefLock); UtlHashMap* myHashMap = dynamic_cast<UtlHashMap*>(mpMyContainer); if (myHashMap) { OsLock container(myHashMap->mContainerLock); UtlContainer::releaseIteratorConnectionLock(); myHashMap->removeIterator(this); /* * A UtlHashMap cannot be resized when there is an iterator associated with it, * so it's possible that it has grown while this iterator existed and that it * needs to be resized. Check for and do that now if needed. */ myHashMap->resizeIfNeededAndSafe(); mpMyContainer = NULL; } else { UtlContainer::releaseIteratorConnectionLock(); } }