[lldb] Use SmallVector::erase correctly

erase() invalidates the iterator, we must use the returned iterator to
continue iterating.

This does not actually make a difference with the current implementation
of SmallVector (erase will effectively return the same pointer), but it
avoids future confusion.
This commit is contained in:
Pavel Labath 2024-06-28 10:18:58 +02:00
parent 1130e923e2
commit b22ea2dc1e

View File

@ -202,7 +202,7 @@ bool Broadcaster::BroadcasterImpl::RemoveListener(
if (!curr_listener_sp) {
// The weak pointer for this listener didn't resolve, lets' prune it
// as we go.
m_listeners.erase(it);
it = m_listeners.erase(it);
continue;
}
@ -213,8 +213,8 @@ bool Broadcaster::BroadcasterImpl::RemoveListener(
if (!it->second)
m_listeners.erase(it);
return true;
} else
it++;
}
it++;
}
return false;
}