From 565359937e9e467592590e1d8cd37c9407a7e2c9 Mon Sep 17 00:00:00 2001 From: "paulg@google.com" Date: Tue, 12 May 2009 19:08:28 +0000 Subject: Don't access the notification service once it has been deleted. This crash happens at shutdown where the notification service is deleted by its owning thread during the normal thread tear down process. In progress requests may still exist at this point (and are about to be cleaned up) so they must not use the service. BUG=11491 (http://crbug.com/11491) Review URL: http://codereview.chromium.org/115222 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@15884 0039d316-1c4b-4281-b951-d872f2087c98 --- .../browser/renderer_host/safe_browsing_resource_handler.cc | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'chrome') diff --git a/chrome/browser/renderer_host/safe_browsing_resource_handler.cc b/chrome/browser/renderer_host/safe_browsing_resource_handler.cc index 02b946b..aabaf4a 100644 --- a/chrome/browser/renderer_host/safe_browsing_resource_handler.cc +++ b/chrome/browser/renderer_host/safe_browsing_resource_handler.cc @@ -48,11 +48,14 @@ SafeBrowsingResourceHandler::SafeBrowsingResourceHandler( } SafeBrowsingResourceHandler::~SafeBrowsingResourceHandler() { - NotificationService::current()->RemoveObserver( - this, - NotificationType::RESOURCE_MESSAGE_FILTER_SHUTDOWN, - Source( - static_cast(receiver_))); + NotificationService* notification_service = NotificationService::current(); + if (notification_service) { + notification_service->RemoveObserver( + this, + NotificationType::RESOURCE_MESSAGE_FILTER_SHUTDOWN, + Source( + static_cast(receiver_))); + } } bool SafeBrowsingResourceHandler::OnUploadProgress(int request_id, -- cgit v1.1