Subject: bug#12327: Signal-handler cleanup for Emacs

From: martin rudalics <[email-masked]>
Date: Thu, 06 Sep 2012 16:41:27 +0200

> Crash is in r109893 built on Windows XP using MingGW gcc 4.6.2.
> 
> To reproduce it, run "M-x rgrep" using Cygwin grep. The grep
> output is all displayed in the *grep* buffer, and then emacs aborts.

With r109905 doing M-x shell and then exit gets me

Breakpoint 1, emacs_abort () at w32fns.c:7201
7201	  button = MessageBox (NULL,
(gdb) bt
#0  emacs_abort () at w32fns.c:7201
#1  0x010345e2 in sys_wait (status=0x82f284) at w32proc.c:462
#2  0x01031ff0 in record_child_status_change () at process.c:6422
#3  0x01032315 in handle_child_signal (sig=18) at process.c:6529
#4  0x010dd5fa in handle_on_main_thread (sig=18, handler=0x1032306 <handle_child_signal>) at sysdep.c:1584
#5  0x01032334 in deliver_child_signal (sig=18) at process.c:6536
#6  0x010358ec in sys_select (nfds=4, rfds=0x82f704, wfds=0x0, efds=0x0, timeout=0x82f6f4, ignored=0x0) at w32proc.c:1325
#7  0x0102f943 in wait_reading_process_output (time_limit=900, nsecs=0, read_kbd=-1, do_display=1, wait_for_cell=52672538, wait_proc=0x0, just_wait_proc=0) at process.c:4682
#8  0x010a4b7e in sit_for (timeout=3600, reading=true, do_display=1) at dispnew.c:5972
#9  0x010071dc in read_char (commandflag=1, nmaps=3, maps=0x82f9a0, prev_event=52672538, used_mouse_menu=0x82fa78, end_time=0x0) at keyboard.c:2742
#10 0x01011081 in read_key_sequence (keybuf=0x82fc00, bufsize=30, prompt=52672538, dont_downcase_last=0, can_return_switch_frame=1, fix_current_buffer=1) at keyboard.c:9356
#11 0x01004fad in command_loop_1 () at keyboard.c:1499
#12 0x0101e737 in internal_condition_case (bfun=0x1004c3e <command_loop_1>, handlers=52723146, hfun=0x10045e8 <cmd_error>) at eval.c:1319
#13 0x0100496f in command_loop_2 (ignore=52672538) at keyboard.c:1194
#14 0x0101e26b in internal_catch (tag=52712978, func=0x100494b <command_loop_2>, arg=52672538) at eval.c:1076
#15 0x0100492b in command_loop () at keyboard.c:1173
#16 0x01004225 in recursive_edit_1 () at keyboard.c:794
#17 0x01004374 in Frecursive_edit () at keyboard.c:858
#18 0x010028e6 in main (argc=1, argv=0xa32808) at emacs.c:1643

martin, on GNU Emacs 24.2.50.1 (i386-mingw-nt5.1.2600)
  of 2012-09-06 on MACHNO