Index: chrome/browser/extensions/webstore_install_helper.cc |
diff --git a/chrome/browser/extensions/webstore_install_helper.cc b/chrome/browser/extensions/webstore_install_helper.cc |
index e9199ed117cd07e29257857460e9ec811bf1aec8..2148937b2e02104d35f851deffadc11809a8f086 100644 |
--- a/chrome/browser/extensions/webstore_install_helper.cc |
+++ b/chrome/browser/extensions/webstore_install_helper.cc |
@@ -35,7 +35,6 @@ WebstoreInstallHelper::WebstoreInstallHelper( |
icon_base64_data_(icon_data), |
icon_url_(icon_url), |
context_getter_(context_getter), |
- utility_host_(NULL), |
icon_decode_complete_(false), |
manifest_parse_complete_(false), |
parse_error_(Delegate::UNKNOWN_ERROR) {} |
@@ -67,7 +66,8 @@ void WebstoreInstallHelper::Start() { |
void WebstoreInstallHelper::StartWorkOnIOThread() { |
CHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
- utility_host_ = new UtilityProcessHost(this, BrowserThread::IO); |
+ utility_host_ = |
+ (new UtilityProcessHost(this, BrowserThread::IO))->AsWeakPtr(); |
utility_host_->set_use_linux_zygote(true); |
utility_host_->StartBatchMode(); |
@@ -172,8 +172,10 @@ void WebstoreInstallHelper::ReportResultsIfComplete() { |
return; |
// The utility_host_ will take care of deleting itself after this call. |
- utility_host_->EndBatchMode(); |
- utility_host_ = NULL; |
+ if (utility_host_) { |
+ utility_host_->EndBatchMode(); |
+ utility_host_.reset(); |
+ } |
BrowserThread::PostTask( |
BrowserThread::UI, |