diff -r 2e6cbacafdc7 -r 94c67ae846fc sources/interface.cpp --- a/sources/interface.cpp Wed Jan 27 19:32:55 2021 +0200 +++ b/sources/interface.cpp Wed Jan 27 19:39:14 2021 +0200 @@ -199,6 +199,11 @@ m_needRefresh = false; } +Interface::~Interface() +{ + ::endwin(); +} + // ------------------------------------------------------------------------------------------------- // void Interface::renderTitlebar() @@ -628,7 +633,7 @@ // ------------------------------------------------------------------------------------------------- // -void Interface::handleInput() +void Interface::handleInput(bool* shouldquit) { int ch = ::getch(); @@ -679,8 +684,7 @@ } else { - endwin(); - throw Exitception(); + *shouldquit = true; } }); break; @@ -833,7 +837,7 @@ case INPUTSTATE_NORMAL: if (getCurrentInput()[0] == '/') { - handleCommand(getCurrentInput()); + handleCommand(getCurrentInput(), shouldquit); flushInput(); } else if (m_session.sendCommand(getCurrentInput())) @@ -1052,7 +1056,7 @@ // ------------------------------------------------------------------------------------------------- // -void Interface::handleCommand(const std::string& input) +void Interface::handleCommand(const std::string& input, bool* shouldquit) { if (input[0] != '/') return; @@ -1079,8 +1083,7 @@ else if (command == "quit") { m_session.disconnect(); - endwin(); - throw Exitception(); + *shouldquit = true; } else printError("Unknown command: %s\n", command.data());