Hello,

xterm has an annoying delay when it's being close by the window manager
when child processes exist.

Test 1:
        xterm -e "sh"

Now hit the "X" button or whatever your window manager provides to send a
window delete event. Xterm should close almost instantly.

Test 2:
        xterm -e "sh -c sh"

You can execute this, or just open xterm and open another shell inside.
Now close it again. In this situation it takes about 1 second to close.

Window deletion triggers do_hangup(), which invokes a kill(-pid, SIGHUP)
and then waits around one second before it quits. I couldn't figure out
what it does in this time. But ktrace hints that it ran into a Sleep()
statement because the delay is right after a select and fd_set, which is
only called in Sleep().

I looked and the xterm menu Quit function and found that it does something
slightly different than than window delete. It also sends kill(-pid,SIGHUP),
but then immediately exits.

Handle_send_signal and Cleanup are doing the same thing, except Cleanup
calls exit right afterwards.

My naive assumtion is, that this would also be the right behavior on
window deletion.


Index: app/xterm/menu.c
===================================================================
RCS file: /cvs/xenocara/app/xterm/menu.c,v
retrieving revision 1.30
diff -u -p -u -p -r1.30 menu.c
--- app/xterm/menu.c    20 Jan 2020 21:03:35 -0000      1.30
+++ app/xterm/menu.c    8 Nov 2020 15:49:08 -0000
@@ -1422,7 +1422,7 @@ do_hangup(Widget gw,
          XtPointer closure GCC_UNUSED,
          XtPointer data GCC_UNUSED)
 {
-    handle_send_signal(gw, SIGHUP);
+    Cleanup(SIGHUP);
 }
 
 /* ARGSUSED */

Reply via email to