diff options
author | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-04 00:00:34 +0000 |
---|---|---|
committer | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-04 00:00:34 +0000 |
commit | d7dfe814d7f3afa088da8c798397f3a414ced1a8 (patch) | |
tree | 436bf66e2f2bef5600f0d4f3e68ab8ef4e4eeb6c /chrome/browser/task_manager_win.cc | |
parent | e0ef2c2a4c8b36c422bbbbad31c55fb64391c7ed (diff) | |
download | chromium_src-d7dfe814d7f3afa088da8c798397f3a414ced1a8.zip chromium_src-d7dfe814d7f3afa088da8c798397f3a414ced1a8.tar.gz chromium_src-d7dfe814d7f3afa088da8c798397f3a414ced1a8.tar.bz2 |
It looks like the unit tests instantiate the TaskManagerView without actually creating the window it lives in. Make sure the table is only allocated and initialized when it's inserted into a view hierarchy to avoid leaking the columns.
BUG=none
TEST=purify unit test bot
Review URL: http://codereview.chromium.org/118199
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@17573 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/task_manager_win.cc')
-rw-r--r-- | chrome/browser/task_manager_win.cc | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/chrome/browser/task_manager_win.cc b/chrome/browser/task_manager_win.cc index e88024d..511d881 100644 --- a/chrome/browser/task_manager_win.cc +++ b/chrome/browser/task_manager_win.cc @@ -260,7 +260,13 @@ TaskManagerViewImpl::TaskManagerViewImpl(TaskManager* task_manager, : task_manager_(task_manager), model_(model), is_always_on_top_(false) { - Init(); + kill_button_.reset(new views::NativeButton( + this, l10n_util::GetString(IDS_TASK_MANAGER_KILL))); + kill_button_->AddAccelerator(views::Accelerator('E', false, false, false)); + kill_button_->SetAccessibleKeyboardShortcut(L"E"); + about_memory_link_.reset(new views::Link( + l10n_util::GetString(IDS_TASK_MANAGER_ABOUT_MEMORY_LINK))); + about_memory_link_->SetController(this); } TaskManagerViewImpl::~TaskManagerViewImpl() { @@ -296,6 +302,7 @@ void TaskManagerViewImpl::Init() { tab_table_ = new views::GroupTableView(table_model_.get(), columns_, views::ICON_AND_TEXT, false, true, true); + AddChildView(tab_table_); // Hide some columns by default tab_table_->SetColumnVisibility(IDS_TASK_MANAGER_PROCESS_ID_COLUMN, false); @@ -310,13 +317,6 @@ void TaskManagerViewImpl::Init() { tab_table_->AddColumn(col); tab_table_->SetObserver(this); SetContextMenuController(this); - kill_button_.reset(new views::NativeButton( - this, l10n_util::GetString(IDS_TASK_MANAGER_KILL))); - kill_button_->AddAccelerator(views::Accelerator('E', false, false, false)); - kill_button_->SetAccessibleKeyboardShortcut(L"E"); - about_memory_link_.reset(new views::Link( - l10n_util::GetString(IDS_TASK_MANAGER_ABOUT_MEMORY_LINK))); - about_memory_link_->SetController(this); // Makes sure our state is consistent. OnSelectionChanged(); @@ -357,8 +357,7 @@ void TaskManagerViewImpl::ViewHierarchyChanged(bool is_add, if (is_add) { parent->AddChildView(kill_button_.get()); parent->AddChildView(about_memory_link_.get()); - if (tab_table_->GetParent() != this) - AddChildView(tab_table_); + Init(); } else { parent->RemoveChildView(kill_button_.get()); parent->RemoveChildView(about_memory_link_.get()); |