]> git.eshelyaron.com Git - emacs.git/commitdiff
Provisional fix for bug #16479 with client connecting while in a TTY menu.
authorEli Zaretskii <eliz@gnu.org>
Fri, 17 Jan 2014 11:55:00 +0000 (13:55 +0200)
committerEli Zaretskii <eliz@gnu.org>
Fri, 17 Jan 2014 11:55:00 +0000 (13:55 +0200)
 src/menu.c (Fx_popup_menu): When invoking tty_menu_show, temporarily
 switch to single keyboard.  Prevents daemon crashes when a new
 client connects while we show a TTY menu in an existing client.

src/ChangeLog
src/menu.c

index 6998df7b62593bd005fd7392ccf5fd30f3f9af0d..d36e60a4e95a5644bd904fd9c0c7cd734cfb0b3c 100644 (file)
@@ -1,3 +1,10 @@
+2014-01-17  Eli Zaretskii  <eliz@gnu.org>
+
+       * menu.c (Fx_popup_menu): When invoking tty_menu_show, temporarily
+       switch to single keyboard.  Prevents daemon crashes when a new
+       client connects while we show a TTY menu in an existing client.
+       (Bug#16479)
+
 2014-01-14  Paul Eggert  <eggert@cs.ucla.edu>
 
        Fix MinGW64 porting problem with _setjmp.
index dc3198faf0e4e5c5eee6f8ce8202b0ca0452c790..c38152f47e8469724948be7f489c08a362256c04 100644 (file)
@@ -1443,8 +1443,16 @@ no quit occurs and `x-popup-menu' returns nil.  */)
   else
 #endif
   if (FRAME_TERMCAP_P (f))
-    selection = tty_menu_show (f, xpos, ypos, for_click, keymaps, title,
-                              kbd_menu_navigation, &error_name);
+    {
+      ptrdiff_t count1 = SPECPDL_INDEX ();
+
+      /* Avoid crashes if, e.g., another client will connect while we
+        are in a menu.  */
+      temporarily_switch_to_single_kboard (f);
+      selection = tty_menu_show (f, xpos, ypos, for_click, keymaps, title,
+                                kbd_menu_navigation, &error_name);
+      unbind_to (count1, Qnil);
+    }
 
 #ifdef HAVE_NS
   unbind_to (specpdl_count, Qnil);