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

Unified Diff: webrtc/pc/videocapturertracksource.cc

Issue 2717023002: Fix occasional race in VideoCapturerTrackSource seen by memcheck bot. (Closed)
Patch Set: Rebase onto master Created 3 years, 10 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 | « webrtc/pc/videocapturertracksource.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/pc/videocapturertracksource.cc
diff --git a/webrtc/pc/videocapturertracksource.cc b/webrtc/pc/videocapturertracksource.cc
index 2bb29da1145a36f46aabc1a947f279e360ba4984..2c64b42a079af86104482bf7e6ec17d4e116df36 100644
--- a/webrtc/pc/videocapturertracksource.cc
+++ b/webrtc/pc/videocapturertracksource.cc
@@ -382,10 +382,14 @@ void VideoCapturerTrackSource::OnStateChange(
cricket::VideoCapturer* capturer,
cricket::CaptureState capture_state) {
if (rtc::Thread::Current() != signaling_thread_) {
+ // Use rtc::Unretained, because we don't want this to capture a reference
+ // to ourselves. If our destructor is called while this task is executing,
+ // that's fine; our AsyncInvoker destructor will wait for it to finish if
+ // it isn't simply canceled.
invoker_.AsyncInvoke<void>(
RTC_FROM_HERE, signaling_thread_,
- rtc::Bind(&VideoCapturerTrackSource::OnStateChange, this, capturer,
- capture_state));
+ rtc::Bind(&VideoCapturerTrackSource::OnStateChange,
+ rtc::Unretained(this), capturer, capture_state));
return;
}
« no previous file with comments | « webrtc/pc/videocapturertracksource.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698