[gnome-terminal] window: Pop down context menu before closing the window



commit 594cfa2c84a210e43418551627af0e48f52a9922
Author: Christian Persch <chpe gnome org>
Date:   Fri Apr 12 22:18:13 2013 +0200

    window: Pop down context menu before closing the window
    
    This fixes a crash when the context menu is open while the window closes (e.g.
    because the terminal application is exiting).
    
    https://bugzilla.redhat.com/show_bug.cgi?id=858948

 src/terminal-window.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)
---
diff --git a/src/terminal-window.c b/src/terminal-window.c
index e25dea4..c6f83a9 100644
--- a/src/terminal-window.c
+++ b/src/terminal-window.c
@@ -1999,6 +1999,15 @@ terminal_window_dispose (GObject *object)
   TerminalApp *app;
   GdkScreen *screen;
   GtkClipboard *clipboard;
+  GSList *list, *l;
+
+  /* Deactivate open popup menus. This fixes a crash if the window is closed
+   * while the context menu is open.
+   */
+  list = gtk_ui_manager_get_toplevels (priv->ui_manager, GTK_UI_MANAGER_POPUP);
+  for (l = list; l != NULL; l = l->next)
+    if (GTK_IS_MENU (l->data))
+      gtk_menu_popdown (GTK_MENU (l->data));
 
   remove_popup_info (window);
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]