diff options
author | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-04 19:01:03 +0000 |
---|---|---|
committer | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-04 19:01:03 +0000 |
commit | 95698919b73ea35ffd9cdb577f4bc2e7b1f6444b (patch) | |
tree | 532394a561ecbd82c1aabe760b941c68a14f399e /chrome/browser/gtk/task_manager_gtk.cc | |
parent | eaabbb3075a5f9205dfe86dd2c3fce6c80b4f608 (diff) | |
download | chromium_src-95698919b73ea35ffd9cdb577f4bc2e7b1f6444b.zip chromium_src-95698919b73ea35ffd9cdb577f4bc2e7b1f6444b.tar.gz chromium_src-95698919b73ea35ffd9cdb577f4bc2e7b1f6444b.tar.bz2 |
GTK: Properly convert task manager UI row to task manager model row.
Also clean up some leaking tree paths.
BUG=22961
TEST=after sorting, task manager still works normally
Review URL: http://codereview.chromium.org/362001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@30976 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/gtk/task_manager_gtk.cc')
-rw-r--r-- | chrome/browser/gtk/task_manager_gtk.cc | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/chrome/browser/gtk/task_manager_gtk.cc b/chrome/browser/gtk/task_manager_gtk.cc index 78c3e97..8695346 100644 --- a/chrome/browser/gtk/task_manager_gtk.cc +++ b/chrome/browser/gtk/task_manager_gtk.cc @@ -634,10 +634,14 @@ void TaskManagerGtk::KillSelectedProcesses() { GtkTreeModel* model; GList* paths = gtk_tree_selection_get_selected_rows(selection, &model); for (GList* item = paths; item; item = item->next) { - int row = gtk_tree::GetRowNumForPath( + GtkTreePath* path = gtk_tree_model_sort_convert_path_to_child_path( + GTK_TREE_MODEL_SORT(process_list_sort_), reinterpret_cast<GtkTreePath*>(item->data)); + int row = gtk_tree::GetRowNumForPath(path); + gtk_tree_path_free(path); task_manager_->KillProcess(row); } + g_list_foreach(paths, reinterpret_cast<GFunc>(gtk_tree_path_free), NULL); g_list_free(paths); } @@ -656,10 +660,15 @@ void TaskManagerGtk::ActivateFocusedTab() { GtkTreeModel* model; GList* selected = gtk_tree_selection_get_selected_rows(selection, &model); if (selected) { - int row = gtk_tree::GetRowNumForPath( + GtkTreePath* path = gtk_tree_model_sort_convert_path_to_child_path( + GTK_TREE_MODEL_SORT(process_list_sort_), reinterpret_cast<GtkTreePath*>(selected->data)); + int row = gtk_tree::GetRowNumForPath(path); + gtk_tree_path_free(path); task_manager_->ActivateProcess(row); } + g_list_foreach(selected, reinterpret_cast<GFunc>(gtk_tree_path_free), NULL); + g_list_free(selected); } void TaskManagerGtk::OnLinkActivated() { @@ -750,13 +759,17 @@ void TaskManagerGtk::OnSelectionChanged(GtkTreeSelection* selection, GtkTreeModel* model; GList* paths = gtk_tree_selection_get_selected_rows(selection, &model); for (GList* item = paths; item; item = item->next) { - int row = gtk_tree::GetRowNumForPath( + GtkTreePath* path = gtk_tree_model_sort_convert_path_to_child_path( + GTK_TREE_MODEL_SORT(task_manager->process_list_sort_), reinterpret_cast<GtkTreePath*>(item->data)); + int row = gtk_tree::GetRowNumForPath(path); + gtk_tree_path_free(path); if (task_manager->task_manager_->IsBrowserProcess(row)) { selection_contains_browser_process = true; break; } } + g_list_foreach(paths, reinterpret_cast<GFunc>(gtk_tree_path_free), NULL); g_list_free(paths); bool sensitive = (paths != NULL) && !selection_contains_browser_process; |