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

Unified Diff: media/base/pipeline.cc

Issue 444333007: Pipeline: Invalidate weak pointers before returning stop callback. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 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
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;
}

Powered by Google App Engine
This is Rietveld 408576698