Index: media/base/pipeline.cc |
diff --git a/media/base/pipeline.cc b/media/base/pipeline.cc |
index c1446828394c60a725fc2c33700d2270e7a5e05f..df3ddade7483e51d6f9d662fd92cdd47d532e5a1 100644 |
--- a/media/base/pipeline.cc |
+++ b/media/base/pipeline.cc |
@@ -602,7 +602,14 @@ void Pipeline::StopTask(const base::Closure& stop_cb) { |
DCHECK(stop_cb_.is_null()); |
if (state_ == kStopped) { |
+ // Invalid all weak pointers so it's safe to destroy |this| on the render |
+ // main thread. |
+ weak_factory_.InvalidateWeakPtrs(); |
+ |
+ // NOTE: pipeline may be deleted at this point in time as a result of |
+ // executing |stop_cb|. |
stop_cb.Run(); |
+ |
return; |
} |