From 20adfbd8eaf2427526b582b60db74e0b408e0874 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Fri, 17 Jan 2014 13:55:00 +0200 Subject: [PATCH] Provisional fix for bug #16479 with client connecting while in a TTY menu. 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 | 7 +++++++ src/menu.c | 12 ++++++++++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 6998df7b62..d36e60a4e9 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,10 @@ +2014-01-17 Eli Zaretskii + + * 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 Fix MinGW64 porting problem with _setjmp. diff --git a/src/menu.c b/src/menu.c index dc3198faf0..c38152f47e 100644 --- a/src/menu.c +++ b/src/menu.c @@ -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); -- 2.20.1