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

Unified Diff: content/renderer/image_downloader/image_downloader_impl.cc

Issue 2286603002: Forbid ImageDownloaderImpl from accessing RenderThread instance after message loop shutdown. (Closed)
Patch Set: Add comments to explain why we do the null check Created 4 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/image_downloader/image_downloader_impl.cc
diff --git a/content/renderer/image_downloader/image_downloader_impl.cc b/content/renderer/image_downloader/image_downloader_impl.cc
index ac4995a2fec9d3343a410706ee1635a4c103f67d..5cb89edfb2a59ae55b4cdc8194bdfcfd6c9626ac 100644
--- a/content/renderer/image_downloader/image_downloader_impl.cc
+++ b/content/renderer/image_downloader/image_downloader_impl.cc
@@ -130,7 +130,12 @@ ImageDownloaderImpl::ImageDownloaderImpl(
}
ImageDownloaderImpl::~ImageDownloaderImpl() {
- RenderThread::Get()->RemoveObserver(this);
+ RenderThread* thread = RenderThread::Get();
+ // As ImageDownloaderImpl is a strong binding with message pipe, the
+ // destructor may run after message loop shutdown, so we need to check whether
+ // RenderThread is null.
+ if (thread)
+ thread->RemoveObserver(this);
}
// static
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698