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

Unified Diff: net/base/file_stream_context.cc

Issue 887863002: The ReadFile API on Windows invoked by the FileStream::Context class which is used by URLRequestFil… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Ensure that the weak pointers are invalidated on Windows when the context is orphaned. Created 5 years, 11 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: net/base/file_stream_context.cc
diff --git a/net/base/file_stream_context.cc b/net/base/file_stream_context.cc
index 5acaab6eb63bd25078a7ced3493a415c82f103bd..fc2af1baac570f9506bdda9d18af9f1ee3a89633 100644
--- a/net/base/file_stream_context.cc
+++ b/net/base/file_stream_context.cc
@@ -77,6 +77,12 @@ void FileStream::Context::Orphan() {
orphaned_ = true;
+#if defined(OS_WIN)
+ // Clean up weak pointers here to ensure that they are destroyed on the
+ // same thread where they were created.
+ weak_ptr_factory_.InvalidateWeakPtrs();
+#endif
+
if (!async_in_progress_) {
CloseAndDelete();
} else if (file_.IsValid()) {

Powered by Google App Engine
This is Rietveld 408576698