diff options
author | Roxie Linden <roxie@lindenlab.com> | 2024-04-30 12:58:07 -0700 |
---|---|---|
committer | Roxie Linden <roxie@lindenlab.com> | 2024-04-30 12:58:07 -0700 |
commit | f9cb9a2b057b2ebc2e1f5cbf479e56595c0fdfb8 (patch) | |
tree | 48cb3f564a60e12f95301e503078428e56852c2c /indra/newview/llvoicewebrtc.cpp | |
parent | 2c503997204043fcd24d70854799509c0675d76d (diff) |
Can't delete from a map while iterating over it.
Diffstat (limited to 'indra/newview/llvoicewebrtc.cpp')
-rw-r--r-- | indra/newview/llvoicewebrtc.cpp | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/indra/newview/llvoicewebrtc.cpp b/indra/newview/llvoicewebrtc.cpp index 2bd6eee84d..0823358e03 100644 --- a/indra/newview/llvoicewebrtc.cpp +++ b/indra/newview/llvoicewebrtc.cpp @@ -1230,16 +1230,19 @@ void LLWebRTCVoiceClient::sessionState::removeParticipant(const LLWebRTCVoiceCli void LLWebRTCVoiceClient::sessionState::removeAllParticipants(const LLUUID ®ion) { - LL_DEBUGS("Voice") << "called" << LL_ENDL; - + std::vector<participantStatePtr_t> participantsToRemove; - for (auto &&participant : mParticipantsByUUID) + for (auto& participantEntry : mParticipantsByUUID) { - if (region.isNull() || (participant.second->mRegion == region)) + if (region.isNull() || (participantEntry.second->mRegion == region)) { - removeParticipant(participant.second); + participantsToRemove.push_back(participantEntry.second); } } + for (auto& participant : participantsToRemove) + { + removeParticipant(participant); + } } // Initiated the various types of sessions. |