summaryrefslogtreecommitdiffstats
path: root/dom
diff options
context:
space:
mode:
authorBryce Van Dyk <bvandyk@mozilla.com>2018-04-18 15:30:57 -0400
committerwolfbeast <mcwerewolf@gmail.com>2018-04-29 13:41:40 +0200
commit65a580a4efedf51cc542fff8c12b487a2113b987 (patch)
tree6967fc13632c63a27644f3e57a50f3b543f5626f /dom
parentd308db119d48ce858b194a720f7946349b5f9b47 (diff)
downloadUXP-65a580a4efedf51cc542fff8c12b487a2113b987.tar
UXP-65a580a4efedf51cc542fff8c12b487a2113b987.tar.gz
UXP-65a580a4efedf51cc542fff8c12b487a2113b987.tar.lz
UXP-65a580a4efedf51cc542fff8c12b487a2113b987.tar.xz
UXP-65a580a4efedf51cc542fff8c12b487a2113b987.zip
Bug 1453127 - Do not use iterators in MediaStreamTrack when removing listeners. r=pehrsons a=lizzard
--HG-- extra : source : 6b3aaee40f7507e240da08d6e073cff3c53971f4 extra : intermediate-source : 59e50af7afe19f827dd687ea097d5ba551ab0b1d
Diffstat (limited to 'dom')
-rw-r--r--dom/media/MediaStreamTrack.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/dom/media/MediaStreamTrack.cpp b/dom/media/MediaStreamTrack.cpp
index 8ccdeb90c..75cdeb1d1 100644
--- a/dom/media/MediaStreamTrack.cpp
+++ b/dom/media/MediaStreamTrack.cpp
@@ -165,11 +165,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);
}
}