diff options
author | Tristan Van Berkom <tristan.van.berkom@gmail.com> | 2010-11-25 14:04:52 +0900 |
---|---|---|
committer | Tristan Van Berkom <tristan.van.berkom@gmail.com> | 2010-11-25 14:08:55 +0900 |
commit | 6716e7c3f1925560a5b4901581cabbaee4e01e28 (patch) | |
tree | c7c54759ce3b4c0e54ef5061174ebb24b6981824 | |
parent | 2e3935ba9db3a7864b3eefed5da800b26aef97ef (diff) | |
download | gtk+-6716e7c3f1925560a5b4901581cabbaee4e01e28.tar.gz |
Fixed GtkMenuShell to deactivate itself at dispose time
Since GdkDevice stuff, it seems that destroying an active
menu doesnt get rid of all the device grabery, this fixes
bug 635693.
-rw-r--r-- | gtk/gtkmenu.c | 7 | ||||
-rw-r--r-- | gtk/gtkmenushell.c | 12 |
2 files changed, 17 insertions, 2 deletions
diff --git a/gtk/gtkmenu.c b/gtk/gtkmenu.c index 3032f3b95e..13998ee1b9 100644 --- a/gtk/gtkmenu.c +++ b/gtk/gtkmenu.c @@ -1760,8 +1760,11 @@ gtk_menu_popdown (GtkMenu *menu) /* The X Grab, if present, will automatically be removed when we hide * the window */ - gtk_widget_hide (menu->toplevel); - gtk_window_set_transient_for (GTK_WINDOW (menu->toplevel), NULL); + if (menu->toplevel) + { + gtk_widget_hide (menu->toplevel); + gtk_window_set_transient_for (GTK_WINDOW (menu->toplevel), NULL); + } pointer = _gtk_menu_shell_get_grab_device (menu_shell); diff --git a/gtk/gtkmenushell.c b/gtk/gtkmenushell.c index d630cdd253..7b94ce9b25 100644 --- a/gtk/gtkmenushell.c +++ b/gtk/gtkmenushell.c @@ -153,6 +153,7 @@ static void gtk_menu_shell_get_property (GObject *object, GParamSpec *pspec); static void gtk_menu_shell_realize (GtkWidget *widget); static void gtk_menu_shell_finalize (GObject *object); +static void gtk_menu_shell_dispose (GObject *object); static gint gtk_menu_shell_button_press (GtkWidget *widget, GdkEventButton *event); static gint gtk_menu_shell_button_release (GtkWidget *widget, @@ -222,6 +223,7 @@ gtk_menu_shell_class_init (GtkMenuShellClass *klass) object_class->set_property = gtk_menu_shell_set_property; object_class->get_property = gtk_menu_shell_get_property; object_class->finalize = gtk_menu_shell_finalize; + object_class->dispose = gtk_menu_shell_dispose; widget_class->realize = gtk_menu_shell_realize; widget_class->button_press_event = gtk_menu_shell_button_press; @@ -463,6 +465,16 @@ gtk_menu_shell_finalize (GObject *object) } +static void +gtk_menu_shell_dispose (GObject *object) +{ + GtkMenuShell *menu_shell = GTK_MENU_SHELL (object); + + gtk_menu_shell_deactivate (menu_shell); + + G_OBJECT_CLASS (gtk_menu_shell_parent_class)->dispose (object); +} + void gtk_menu_shell_append (GtkMenuShell *menu_shell, GtkWidget *child) |