Fix bug #16479 with client connections while TTY menu is open.
authorEli Zaretskii <eliz@gnu.org>
Sat, 25 Jan 2014 08:25:51 +0000 (10:25 +0200)
committerEli Zaretskii <eliz@gnu.org>
Sat, 25 Jan 2014 08:25:51 +0000 (10:25 +0200)
 src/term.c (read_menu_input): If the selected frame changes, exit
 the menu.
 (tty_menu_show): If the selected frame changes while we displayed
 a menu, throw to top level.

src/ChangeLog
src/term.c

index 98c890c..89b4c06 100644 (file)
@@ -1,3 +1,10 @@
+2014-01-25  Eli Zaretskii  <eliz@gnu.org>
+
+       * term.c (read_menu_input): If the selected frame changes, exit
+       the menu.
+       (tty_menu_show): If the selected frame changes while we displayed
+       a menu, throw to top level.  (Bug#16479)
+
 2014-01-25  Stefan Monnier  <monnier@iro.umontreal.ca>
 
        * eval.c (Fsignal): Fix `debug' handling to match 2013-10-03 change.
index 4d8da13..0c40c2d 100644 (file)
@@ -3124,7 +3124,11 @@ read_menu_input (struct frame *sf, int *x, int *y, int min_y, int max_y,
       tty->showing_menu = 0;
       do_mouse_tracking = saved_mouse_tracking;
 
-      if (EQ (cmd, Qt) || EQ (cmd, Qtty_menu_exit))
+      if (EQ (cmd, Qt) || EQ (cmd, Qtty_menu_exit)
+         /* If some input switched frames under our feet, exit the
+            menu, since the menu faces are no longer valid, and the
+            menu is no longer relevant anyway.  */
+         || sf != SELECTED_FRAME ())
        return MI_QUIT_MENU;
       if (EQ (cmd, Qtty_menu_mouse_movement))
        mouse_get_xy (x, y);
@@ -3791,6 +3795,11 @@ tty_menu_show (struct frame *f, int x, int y, bool for_click, bool keymaps,
     case TTYM_IA_SELECT:
       break;
     case TTYM_NO_SELECT:
+      /* If the selected frame was changed while we displayed a menu,
+        throw to top level in order to undo any temporary settings
+        made by TTY menu code.  */
+      if (f != SELECTED_FRAME ())
+       Ftop_level ();
       /* Make "Cancel" equivalent to C-g unless FOR_CLICK (which means
         the menu was invoked with a mouse event as POSITION).  */
       if (! for_click)