Subject: C-z suspends Emacs "forever" (gtk3, Gnome shell)

From: Paul Eggert <[email-masked]>
Date: Thu, 27 Oct 2011 14:49:47 -0700

[This follows up a thread on emacs-devel:
<http://lists.gnu.org/archive/html/emacs-devel/2011-10/msg00956.html>.]

I can reproduce the problem on my host (Fedora Core 15, x86-64),
starting with the trunk (bzr 106209), as follows:

  ./autogen.sh
  ./configure CFLAGS=-g --with-x-toolkit=gtk3
  make -j5
  cd src
  ./emacs -Q
  [ Type C-z into the new Emacs session. ]
  [ Use the Gnome shell Activities to bring Emacs back onto the screen. ]
  [ Emacs comes back onto the screen, but typing into it is ineffective. ]

Here's a backtrace of a frozen Emacs, which I started under GDB
(this is actually bootstrap-emacs):

(gdb) where
#0  0x0000003b8eed91f3 in select () from /lib64/libc.so.6
#1  0x0000000000537d5d in xg_select (max_fds=27, rfds=0x7fffffffce60, wfds=0x7fffffffcde0, efds=0x0, timeout=0x7fffffffcdc0) at xgselect.c:100
#2  0x0000000000659371 in wait_reading_process_output (time_limit=30, microsecs=0, read_kbd=-1, do_display=1, wait_for_cell=12720546, wait_proc=0x0, just_wait_proc=0) at process.c:4607
#3  0x0000000000420934 in sit_for (timeout=120, reading=1, do_display=1) at dispnew.c:5971
#4  0x00000000005650e0 in read_char (commandflag=1, nmaps=2, maps=0x7fffffffd3b0, prev_event=12720546, used_mouse_menu=0x7fffffffd594, end_time=0x0) at keyboard.c:2687
#5  0x0000000000572d71 in read_key_sequence (keybuf=0x7fffffffd800, bufsize=30, prompt=12720546, dont_downcase_last=0, can_return_switch_frame=1, fix_current_buffer=1) at keyboard.c:9290
#6  0x0000000000562862 in command_loop_1 () at keyboard.c:1447
#7  0x00000000005fe79b in internal_condition_case (bfun=0x56247d <command_loop_1>, handlers=12772738, hfun=0x561d65 <cmd_error>) at eval.c:1499
#8  0x000000000056216c in command_loop_2 (ignore=12720546) at keyboard.c:1158
#9  0x00000000005fe125 in internal_catch (tag=12768530, func=0x562146 <command_loop_2>, arg=12720546) at eval.c:1256
#10 0x000000000056211f in command_loop () at keyboard.c:1137
#11 0x00000000005618a9 in recursive_edit_1 () at keyboard.c:757
#12 0x0000000000561a4c in Frecursive_edit () at keyboard.c:821
#13 0x000000000055fb0c in main (argc=2, argv=0x7fffffffe118) at emacs.c:1706
(gdb) up
#1  0x0000000000537d5d in xg_select (max_fds=27, rfds=0x7fffffffce60, wfds=0x7fffffffcde0, efds=0x0, timeout=0x7fffffffcdc0) at xgselect.c:100
(gdb) p max_fds
$1 = 27
(gdb) p all_rfds
$2 = {
  fds_bits = {152895872, 0 <repeats 15 times>}
}
(gdb) p have_wfds
$3 = 1
(gdb) p all_wfds
$4 = {
  fds_bits = {0 <repeats 16 times>}
}
(gdb) p efds
$5 = (fd_set *) 0x0
(gdb) p tmop
$6 = (struct timeval *) 0x7fffffffcdc0
(gdb) p *tmop
$7 = {
  tv_sec = 0, 
  tv_usec = 431064
}