Commit 456ebb57 authored by Dale Curtis's avatar Dale Curtis Committed by Commit Bot

Prevent delegate access after player removal has been signaled.

Should result in nullptr crashes which may be easier to debug to
find culprits which are violating this.

R=tguilbert

Bug: 1035556
Change-Id: I14fe4ad3680e536b1193b47d0127ba46cda6b93e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2451383
Commit-Queue: Thomas Guilbert <tguilbert@chromium.org>
Auto-Submit: Dale Curtis <dalecurtis@chromium.org>
Reviewed-by: default avatarThomas Guilbert <tguilbert@chromium.org>
Cr-Commit-Position: refs/heads/master@{#813993}
parent 9a7ab08c
...@@ -485,6 +485,7 @@ WebMediaPlayerImpl::~WebMediaPlayerImpl() { ...@@ -485,6 +485,7 @@ WebMediaPlayerImpl::~WebMediaPlayerImpl() {
delegate_->PlayerGone(delegate_id_); delegate_->PlayerGone(delegate_id_);
delegate_->RemoveObserver(delegate_id_); delegate_->RemoveObserver(delegate_id_);
delegate_ = nullptr;
// Finalize any watch time metrics before destroying the pipeline. // Finalize any watch time metrics before destroying the pipeline.
watch_time_reporter_.reset(); watch_time_reporter_.reset();
......
...@@ -748,7 +748,7 @@ class MEDIA_BLINK_EXPORT WebMediaPlayerImpl ...@@ -748,7 +748,7 @@ class MEDIA_BLINK_EXPORT WebMediaPlayerImpl
// Document::shutdown() is called before the frame detaches (and before the // Document::shutdown() is called before the frame detaches (and before the
// frame is destroyed). RenderFrameImpl owns |delegate_| and is guaranteed // frame is destroyed). RenderFrameImpl owns |delegate_| and is guaranteed
// to outlive |this|; thus it is safe to store |delegate_| as a raw pointer. // to outlive |this|; thus it is safe to store |delegate_| as a raw pointer.
blink::WebMediaPlayerDelegate* const delegate_; blink::WebMediaPlayerDelegate* delegate_;
int delegate_id_ = 0; int delegate_id_ = 0;
// The playback state last reported to |delegate_|, to avoid setting duplicate // The playback state last reported to |delegate_|, to avoid setting duplicate
......
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