Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(35)

Unified Diff: webrtc/modules/audio_device/ios/objc/RTCAudioSession.mm

Issue 1877643002: Fix RTCAudioSession crash in removeDelegate. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | webrtc/modules/audio_device/ios/objc/RTCAudioSessionTest.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/modules/audio_device/ios/objc/RTCAudioSession.mm
diff --git a/webrtc/modules/audio_device/ios/objc/RTCAudioSession.mm b/webrtc/modules/audio_device/ios/objc/RTCAudioSession.mm
index c6e3677b8461751b7489dea445ff88cc27707356..3b6e05dea1687ba1253704188a1c7eb0b9dd60ca 100644
--- a/webrtc/modules/audio_device/ios/objc/RTCAudioSession.mm
+++ b/webrtc/modules/audio_device/ios/objc/RTCAudioSession.mm
@@ -147,7 +147,8 @@ NSInteger const kRTCAudioSessionErrorConfiguration = -2;
@synchronized(self) {
_delegates.erase(std::remove(_delegates.begin(),
_delegates.end(),
- delegate));
+ delegate),
+ _delegates.end());
[self removeZeroedDelegates];
}
}
@@ -520,11 +521,11 @@ NSInteger const kRTCAudioSessionErrorConfiguration = -2;
- (void)removeZeroedDelegates {
@synchronized(self) {
- for (auto it = _delegates.begin(); it != _delegates.end(); ++it) {
- if (!*it) {
- _delegates.erase(it);
- }
- }
+ _delegates.erase(
+ std::remove_if(_delegates.begin(),
+ _delegates.end(),
+ [](id delegate) -> bool { return delegate == nil; }),
+ _delegates.end());
}
}
« no previous file with comments | « no previous file | webrtc/modules/audio_device/ios/objc/RTCAudioSessionTest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698