зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1453127 - Do not use iterators in MediaStreamTrack when removing listeners. r=pehrsons
--HG-- extra : rebase_source : 41c5d93b54c6dc062daa05a2644d4a194400dd1e extra : amend_source : c53c4f75e4b813104122d22da29f97919f9d62d3
This commit is contained in:
Родитель
e6081ca579
Коммит
855803da5c
|
@ -166,11 +166,15 @@ MediaStreamTrack::Destroy()
|
|||
mPrincipalHandleListener->Forget();
|
||||
mPrincipalHandleListener = nullptr;
|
||||
}
|
||||
for (auto l : mTrackListeners) {
|
||||
RemoveListener(l);
|
||||
// Remove all listeners -- avoid iterating over the list we're removing from
|
||||
const nsTArray<RefPtr<MediaStreamTrackListener>> trackListeners(mTrackListeners);
|
||||
for (auto listener : trackListeners) {
|
||||
RemoveListener(listener);
|
||||
}
|
||||
for (auto l : mDirectTrackListeners) {
|
||||
RemoveDirectListener(l);
|
||||
// Do the same as above for direct listeners
|
||||
const nsTArray<RefPtr<DirectMediaStreamTrackListener>> directTrackListeners(mDirectTrackListeners);
|
||||
for (auto listener : directTrackListeners) {
|
||||
RemoveDirectListener(listener);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче