p-e-w/finalterm — pull request #306 by onli (2014-07-07 13:16:35+00:00)
Title: wait after kill, seems to fix one cause of UI hang (#296)

I don't claim this is a perfect fix. It is a workaround that seems to work on my machine, but you know how hairy those hard to reproduce issues are.

Everything following might be wrong: Posix.kill is async, and seems to be the issue of the ui hang after tab close. Waiting a bit gives the xserver time to send the signal, and the process to actually terminate, before finalterm continues with the close procedure. If that is not done, to my understanding, it might happen that the pid is already used for another process, which could be harmful. It could also be that finalterm happily continues with an unclosed shell-process, which could also be harmful.

My testing procedure was to repeatedly open 10 tabs and to close all of them in a row. Without the sleep, this almost never worked, with the sleep, it always worked.

It might be better to use waitpid instead; I didn't succeed with that.