Reset SIGHUP handler on NCursesUI destruction

SIGHUP handler could trigger crashes if the EventManager was
already destructed when it was triggered.

Fixes #3288
This commit is contained in:
Maxime Coste 2020-01-11 17:22:33 +11:00
parent fe80502bfa
commit b85365bff8

View File

@ -364,7 +364,7 @@ NCursesUI::~NCursesUI()
endwin(); endwin();
tcsetattr(STDIN_FILENO, TCSAFLUSH, &m_original_termios); tcsetattr(STDIN_FILENO, TCSAFLUSH, &m_original_termios);
set_signal_handler(SIGWINCH, SIG_DFL); set_signal_handler(SIGWINCH, SIG_DFL);
set_signal_handler(SIGCONT, SIG_DFL); set_signal_handler(SIGHUP, SIG_DFL);
set_signal_handler(SIGTSTP, SIG_DFL); set_signal_handler(SIGTSTP, SIG_DFL);
} }
@ -567,7 +567,7 @@ Optional<Key> NCursesUI::get_next_key()
if (sighup_raised) if (sighup_raised)
{ {
set_signal_handler(SIGWINCH, SIG_DFL); set_signal_handler(SIGWINCH, SIG_DFL);
set_signal_handler(SIGCONT, SIG_DFL); set_signal_handler(SIGHUP, SIG_DFL);
if (m_window) if (m_window)
m_window.destroy(); m_window.destroy();
m_stdin_watcher.disable(); m_stdin_watcher.disable();