diff options
author | tony@chromium.org <tony@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-10 19:22:57 +0000 |
---|---|---|
committer | tony@chromium.org <tony@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-10 19:22:57 +0000 |
commit | 697b87dd539e18cf21d5e65a7e55919f615e394c (patch) | |
tree | 523ab4fe14c2d884dd5d492fb0471b3b5c18ee58 /chrome/browser/gtk/task_manager_gtk.cc | |
parent | e9923cb7a30065c91964acecf537fe15c2bf768e (diff) | |
download | chromium_src-697b87dd539e18cf21d5e65a7e55919f615e394c.zip chromium_src-697b87dd539e18cf21d5e65a7e55919f615e394c.tar.gz chromium_src-697b87dd539e18cf21d5e65a7e55919f615e394c.tar.bz2 |
Fix accel leak in task manager and bookmark manager by using
the same cleanup code as browser_window_gtk.
Also fix a leak of the gtk widgets when the accelerator was
not used for the task manager. If the user closed by using the
window manager destroy, then we never called gtk_widget_destroy
on the window and leaked the widgets.
Review URL: http://codereview.chromium.org/202035
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@25897 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 | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/chrome/browser/gtk/task_manager_gtk.cc b/chrome/browser/gtk/task_manager_gtk.cc index f7f9906..ebe66a0 100644 --- a/chrome/browser/gtk/task_manager_gtk.cc +++ b/chrome/browser/gtk/task_manager_gtk.cc @@ -249,6 +249,13 @@ TaskManagerGtk* TaskManagerGtk::instance_ = NULL; TaskManagerGtk::~TaskManagerGtk() { task_manager_->OnWindowClosed(); model_->RemoveObserver(this); + + gtk_accel_group_disconnect_key(accel_group_, GDK_w, GDK_CONTROL_MASK); + gtk_window_remove_accel_group(GTK_WINDOW(dialog_), accel_group_); + g_object_unref(accel_group_); + accel_group_ = NULL; + + gtk_widget_destroy(dialog_); } //////////////////////////////////////////////////////////////////////////////// @@ -431,13 +438,10 @@ void TaskManagerGtk::SetInitialDialogSize() { } void TaskManagerGtk::ConnectAccelerators() { - GtkAccelGroup* accel_group = gtk_accel_group_new(); - gtk_window_add_accel_group(GTK_WINDOW(dialog_), accel_group); - - // Drop the initial ref on |accel_group| so |dialog_| will own it. - g_object_unref(accel_group); + accel_group_ = gtk_accel_group_new(); + gtk_window_add_accel_group(GTK_WINDOW(dialog_), accel_group_); - gtk_accel_group_connect(accel_group, + gtk_accel_group_connect(accel_group_, GDK_w, GDK_CONTROL_MASK, GtkAccelFlags(0), g_cclosure_new(G_CALLBACK(OnGtkAccelerator), this, NULL)); @@ -717,7 +721,6 @@ gboolean TaskManagerGtk::OnGtkAccelerator(GtkAccelGroup* accel_group, // is destroyed. The deleted object will receive gtk signals otherwise. gtk_dialog_response(GTK_DIALOG(task_manager->dialog_), GTK_RESPONSE_DELETE_EVENT); - gtk_widget_destroy(task_manager->dialog_); } return TRUE; |