]> git.eshelyaron.com Git - emacs.git/commitdiff
Don't try to display menus and dialogs in an 'initial' frame.
authorEli Zaretskii <eliz@gnu.org>
Fri, 13 Jun 2014 14:42:43 +0000 (17:42 +0300)
committerEli Zaretskii <eliz@gnu.org>
Fri, 13 Jun 2014 14:42:43 +0000 (17:42 +0300)
 src/menu.c (Fx_popup_menu): Don't call the frame's menu_show_hook if
 the frame is the initial frame, because the hook is not set up
 then, and Emacs crashes.
 Reported by Fabrice Popineau <fabrice.popineau@gmail.com>.

src/ChangeLog
src/menu.c

index e1393f9062734b9a5b85f4ce085323c83ce92ce0..7e3b4a978202e2796f0e0bcad0f901533ddf7087 100644 (file)
@@ -1,3 +1,10 @@
+2014-06-13  Eli Zaretskii  <eliz@gnu.org>
+
+       * menu.c (Fx_popup_menu): Don't call the frame's menu_show_hook if
+       the frame is the initial frame, because the hook is not set up
+       then, and Emacs crashes.
+       Reported by Fabrice Popineau <fabrice.popineau@gmail.com>.
+
 2014-06-12  Stefan Monnier  <monnier@iro.umontreal.ca>
 
        * keymap.c (silly_event_symbol_error): Don't recommend the use
index 96f53903201dd15da468865ade0d022a710549d8..460dc7967b5516a1e3513072aac0159f5b59de3f 100644 (file)
@@ -1410,9 +1410,12 @@ no quit occurs and `x-popup-menu' returns nil.  */)
   record_unwind_protect_void (discard_menu_items);
 #endif
 
-  /* Display them in a menu.  */
-  selection = FRAME_TERMINAL (f)->menu_show_hook (f, xpos, ypos, menuflags,
-                                                 title, &error_name);
+  /* Display them in a menu, but not if F is the initial frame that
+     doesn't have its hooks set (e.g., in a batch session), because
+     such a frame cannot display menus.  */
+  if (!FRAME_INITIAL_P (f))
+    selection = FRAME_TERMINAL (f)->menu_show_hook (f, xpos, ypos, menuflags,
+                                                   title, &error_name);
 
 #ifdef HAVE_NS
   unbind_to (specpdl_count, Qnil);