Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5084)

Unified Diff: chrome/browser/gtk/browser_window_gtk.cc

Issue 155921: Remove the accelerator group when closing the browser window. (Closed)
Patch Set: Created 11 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/gtk/browser_window_gtk.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/gtk/browser_window_gtk.cc
diff --git a/chrome/browser/gtk/browser_window_gtk.cc b/chrome/browser/gtk/browser_window_gtk.cc
index 2d4d1a9347911ae2417f8af837b8325103be4e17..6623e1416b48e1abd5221f8cc2ff3e065d1a1266 100644
--- a/chrome/browser/gtk/browser_window_gtk.cc
+++ b/chrome/browser/gtk/browser_window_gtk.cc
@@ -384,6 +384,7 @@ BrowserWindowGtk::BrowserWindowGtk(Browser* browser)
panel_controller_(NULL),
#endif
frame_cursor_(NULL),
+ accel_group_(NULL),
is_active_(true) {
use_custom_frame_.Init(prefs::kUseCustomChromeFrame,
browser_->profile()->GetPrefs(), this);
@@ -539,6 +540,12 @@ void BrowserWindowGtk::Close() {
if (!CanClose())
return;
+ if (accel_group_) {
+ gtk_window_remove_accel_group(window_, accel_group_);
+ g_object_unref(accel_group_);
+ accel_group_ = NULL;
+ }
+
SaveWindowPosition();
GtkWidget* window = GTK_WIDGET(window_);
@@ -1265,14 +1272,13 @@ void BrowserWindowGtk::UpdateWindowShape(int width, int height) {
}
void BrowserWindowGtk::ConnectAccelerators() {
- GtkAccelGroup* accel_group = gtk_accel_group_new();
- gtk_window_add_accel_group(window_, accel_group);
- // Drop the initial ref on |accel_group| so |window_| will own it.
- g_object_unref(accel_group);
+ // We hold on to our reference, and drop it in Close().
+ GtkAccelGroup* accel_group_ = gtk_accel_group_new();
Evan Stade 2009/07/22 18:21:59 s/GtkAccelGroup* //
+ gtk_window_add_accel_group(window_, accel_group_);
for (size_t i = 0; i < arraysize(kAcceleratorMap); ++i) {
gtk_accel_group_connect(
- accel_group,
+ accel_group_,
kAcceleratorMap[i].keyval,
kAcceleratorMap[i].modifier_type,
GtkAccelFlags(0),
« no previous file with comments | « chrome/browser/gtk/browser_window_gtk.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698