New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix race condition in terminal init #457
Conversation
remove the tcgetattr call to a single time on irssi load instead of querying it each time. Fixes irssi#450
(I hope) |
I think there's no need to call |
they may be applied twice because of term_init being called twice, once from the do_redraw sigcont handler https://github.com/irssi/irssi/blob/master/src/fe-text/term-terminfo.c#L91 and once from the kill-stop function https://github.com/irssi/irssi/blob/master/src/fe-text/term-terminfo.c#L610 |
Exactly, and #452 fixes the problem by sending the smcup only (if available) when we resume from the TSTP signal, we save the current state and then the old settings are re-applied in the SIGCNT handler |
in that case I wonder if even the smcup of the code in your suggestion from #452 is necessary? if so, why? |
The smcup saves the terminal window to be re-applied with a rmcup on the next resume/exit |
but terminfo_cont (which is run by the sigcont hander) also runs smcup so why do we need to send that twice? |
You're right, upon further inspection I've updated the PR |
after discussion on IRC I conclude that we want to have both this and the #452 eventually |
fix race condition in terminal init
fix race condition in terminal init
fix race condition in terminal init
Fixes irssi#733. The fix outlined in irssi#452 had adverse effects for the following reason. The code removed the restoration path that would go on the code path from kill SIGTSTP. The problem is this: When Irssi is not running in a controlling parent (like a shell), the TSTP will in fact be ignored. In that case, there is no process sending a CONT either and thus the screen state never gets restored. Luckily, the patch in irssi#457 is sufficient to prevent the problem in irssi#450 (which lead to the development of irssi#452). To that end, we do end up with potentially calling terminfo_cont twice but that is better than not calling it at all. This reverts commit b1ffd5f, reversing changes made to 9cb0419.
remove the tcgetattr call to a single time on irssi load instead of
querying it each time. Fixes #450