summaryrefslogtreecommitdiff
path: root/gtk/gtkmenu.c
diff options
context:
space:
mode:
Diffstat (limited to 'gtk/gtkmenu.c')
-rw-r--r--gtk/gtkmenu.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/gtk/gtkmenu.c b/gtk/gtkmenu.c
index 446592eda7..64b85b38b2 100644
--- a/gtk/gtkmenu.c
+++ b/gtk/gtkmenu.c
@@ -1473,12 +1473,14 @@ gtk_menu_popdown (GtkMenu *menu)
{
GtkMenuPrivate *private;
GtkMenuShell *menu_shell;
+ gboolean had_parent;
g_return_if_fail (GTK_IS_MENU (menu));
menu_shell = GTK_MENU_SHELL (menu);
private = gtk_menu_get_private (menu);
-
+
+ had_parent = menu_shell->parent_menu_shell != NULL;
menu_shell->parent_menu_shell = NULL;
menu_shell->active = FALSE;
menu_shell->ignore_enter = FALSE;
@@ -1502,7 +1504,8 @@ 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_group_add_window (gtk_window_get_group (NULL), GTK_WINDOW (menu->toplevel));
+ if (had_parent)
+ gtk_window_group_add_window (gtk_window_get_group (NULL), GTK_WINDOW (menu->toplevel));
if (menu->torn_off)
{