summaryrefslogtreecommitdiffstats
path: root/chrome/browser/extensions
diff options
context:
space:
mode:
authorerikkay@google.com <erikkay@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-12 18:39:25 +0000
committererikkay@google.com <erikkay@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-12 18:39:25 +0000
commitfd6521901cb7eb76cdd05d330ea6b70dbdcdf7da (patch)
tree4ec738c67a0797cab83012a1027c8a3f105cdfd2 /chrome/browser/extensions
parentbd4816fe35162438ff2a9e796fe47b15872404ac (diff)
downloadchromium_src-fd6521901cb7eb76cdd05d330ea6b70dbdcdf7da.zip
chromium_src-fd6521901cb7eb76cdd05d330ea6b70dbdcdf7da.tar.gz
chromium_src-fd6521901cb7eb76cdd05d330ea6b70dbdcdf7da.tar.bz2
Fix object ownership and cleanup issues between ExtensionHost and ExtensionView. This was leading to crashes at shutdown as well as shutdown code not cleaning up properly.
BUG=13974 TEST=none Review URL: http://codereview.chromium.org/126064 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@18296 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/extensions')
-rw-r--r--chrome/browser/extensions/extension_host.cc3
-rw-r--r--chrome/browser/extensions/extension_process_manager.cc9
2 files changed, 9 insertions, 3 deletions
diff --git a/chrome/browser/extensions/extension_host.cc b/chrome/browser/extensions/extension_host.cc
index 8ccc9c7..d78d8bc 100644
--- a/chrome/browser/extensions/extension_host.cc
+++ b/chrome/browser/extensions/extension_host.cc
@@ -48,6 +48,9 @@ ExtensionHost::~ExtensionHost() {
void ExtensionHost::CreateView(Browser* browser) {
#if defined(TOOLKIT_VIEWS)
view_.reset(new ExtensionView(this, browser));
+ // We own |view_|, so don't auto delete when it's removed from the view
+ // hierarchy.
+ view_->SetParentOwned(false);
#else
// TODO(port)
NOTREACHED();
diff --git a/chrome/browser/extensions/extension_process_manager.cc b/chrome/browser/extensions/extension_process_manager.cc
index 5f1eada..a511920 100644
--- a/chrome/browser/extensions/extension_process_manager.cc
+++ b/chrome/browser/extensions/extension_process_manager.cc
@@ -34,9 +34,9 @@ ExtensionProcessManager::ExtensionProcessManager(Profile* profile)
}
ExtensionProcessManager::~ExtensionProcessManager() {
- // Copy background_hosts_ to avoid iterator invalidation issues.
- ExtensionHostSet to_delete(background_hosts_.begin(),
- background_hosts_.end());
+ // Copy all_hosts_ to avoid iterator invalidation issues.
+ ExtensionHostSet to_delete(all_hosts_.begin(),
+ all_hosts_.end());
ExtensionHostSet::iterator iter;
for (iter = to_delete.begin(); iter != to_delete.end(); ++iter)
delete *iter;
@@ -45,9 +45,12 @@ ExtensionProcessManager::~ExtensionProcessManager() {
ExtensionHost* ExtensionProcessManager::CreateView(Extension* extension,
const GURL& url,
Browser* browser) {
+ DCHECK(extension);
+ DCHECK(browser);
ExtensionHost* host =
new ExtensionHost(extension, GetSiteInstanceForURL(url), url, this);
host->CreateView(browser);
+ all_hosts_.insert(host);
return host;
}