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; |
} |