Commit 745905ab authored by xians@chromium.org's avatar xians@chromium.org

swap the renderer_ reference to local before calling Stop(), otherwise we will...

swap the renderer_ reference to local before calling Stop(), otherwise we will invalidate the pointer during the Stop() call.

The problem that this CL is trying to fix:
In WebRtcAudioDeviceImpl::Terminate(), when the renderer_ is valid and we call renderer_->Stop(), this Stop() function will trigger a callback till WebRtcAudioDeviceImpl::RemoveAudioRenderer() where we set the renderer_ to NULL. This will crash chrome since renderer_ is being used at the same time.


BUG=241430

Review URL: https://chromiumcodereview.appspot.com/15732021

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@202420 0039d316-1c4b-4281-b951-d872f2087c98
parent cd50f566
......@@ -259,8 +259,11 @@ int32_t WebRtcAudioDeviceImpl::Terminate() {
// It is necessary to stop the |renderer_| before going away.
if (renderer_) {
renderer_->Stop();
renderer_ = NULL;
// Grab a local reference while we call Stop(), which will trigger a call to
// RemoveAudioRenderer that clears our reference to the audio renderer.
scoped_refptr<WebRtcAudioRenderer> local_renderer(renderer_);
local_renderer->Stop();
DCHECK(!renderer_);
}
if (capturer_) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment