summaryrefslogtreecommitdiffstats
path: root/chrome/browser/task_manager.cc
diff options
context:
space:
mode:
authorphajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-20 12:56:43 +0000
committerphajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-20 12:56:43 +0000
commitbed76fded2fb471c26e6f78c6709fb3c3e5a04a3 (patch)
tree29404fe76173adc18407a3ce4b55a4f10a558679 /chrome/browser/task_manager.cc
parent64569cce3a56ca39eea8712a4f91caad7de32be2 (diff)
downloadchromium_src-bed76fded2fb471c26e6f78c6709fb3c3e5a04a3.zip
chromium_src-bed76fded2fb471c26e6f78c6709fb3c3e5a04a3.tar.gz
chromium_src-bed76fded2fb471c26e6f78c6709fb3c3e5a04a3.tar.bz2
Fix a crash on browser exit after opening TaskManager.
TaskManager is a singleton, so it's destroyed by AtExitManager. At the time of destruction it cannot register AtExit callbacks (AtExitManager requires that). It turns out that some Windows view code wants to register an AtExit callback during destruction. For more info about view code, see http://src.chromium.org/viewvc/chrome?view=rev&revision=9161 The fix is to destroy the view early, using EnsureShutdown static method of TaskManager. It was also necessary to delete child views a bit earlier to avoid another crashed. Added a regression browser_test and verified that it's broken without this fix. http://crbug.com/11180 Review URL: http://codereview.chromium.org/114031 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@16474 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/task_manager.cc')
-rw-r--r--chrome/browser/task_manager.cc17
1 files changed, 17 insertions, 0 deletions
diff --git a/chrome/browser/task_manager.cc b/chrome/browser/task_manager.cc
index 7a7a252..c4e186b 100644
--- a/chrome/browser/task_manager.cc
+++ b/chrome/browser/task_manager.cc
@@ -688,6 +688,9 @@ bool TaskManagerModel::GetProcessMetricsForRows(
////////////////////////////////////////////////////////////////////////////////
// static
+bool TaskManager::initialized_ = false;
+
+// static
void TaskManager::RegisterPrefs(PrefService* prefs) {
prefs->RegisterDictionaryPref(prefs::kTaskManagerWindowPlacement);
}
@@ -695,6 +698,7 @@ void TaskManager::RegisterPrefs(PrefService* prefs) {
TaskManager::TaskManager()
: ALLOW_THIS_IN_INITIALIZER_LIST(model_(new TaskManagerModel(this))) {
Init();
+ initialized_ = true;
}
TaskManager::~TaskManager() {
@@ -711,6 +715,19 @@ void TaskManager::Close() {
model_->Clear();
}
+// static
+void TaskManager::EnsureShutdown() {
+ if (!initialized_)
+ return;
+
+ // TaskManager is a singleton, which means it's destroyed by AtExitManager.
+ // At that point it can't register AtExit callbacks etc. It turns out that
+ // view destruction code does it on Windows, so we destroy the view now.
+ TaskManager* task_manager = GetInstance();
+ task_manager->view_.reset();
+ initialized_ = false;
+}
+
bool TaskManager::BrowserProcessIsSelected() {
if (!view_.get())
return false;