Fix detection of client ungraceful disconnection

This commit is contained in:
Maxime Coste 2019-04-04 13:10:38 +11:00
parent d91e017803
commit cc788c888e
2 changed files with 11 additions and 3 deletions

View File

@ -75,7 +75,7 @@ Client* ClientManager::create_client(std::unique_ptr<UserInterface>&& ui, int pi
return contains(m_clients, client) ? client : nullptr; return contains(m_clients, client) ? client : nullptr;
} }
void ClientManager::process_pending_inputs() const void ClientManager::process_pending_inputs()
{ {
while (true) while (true)
{ {
@ -84,8 +84,16 @@ void ClientManager::process_pending_inputs() const
// client input processing, which would break iterator based iteration. // client input processing, which would break iterator based iteration.
// (its fine to skip a client if that happens as had_input will be true // (its fine to skip a client if that happens as had_input will be true
// if a client triggers client removal) // if a client triggers client removal)
for (int i = 0; i < m_clients.size(); ++i) for (int i = 0; i < m_clients.size(); )
{
if (not m_clients[i]->is_ui_ok())
{
remove_client(*m_clients[i], false, -1);
continue;
}
had_input = m_clients[i]->process_pending_inputs() or had_input; had_input = m_clients[i]->process_pending_inputs() or had_input;
++i;
}
if (not had_input) if (not had_input)
break; break;

View File

@ -35,7 +35,7 @@ public:
void add_free_window(std::unique_ptr<Window>&& window, SelectionList selections); void add_free_window(std::unique_ptr<Window>&& window, SelectionList selections);
void redraw_clients() const; void redraw_clients() const;
void process_pending_inputs() const; void process_pending_inputs();
bool has_pending_inputs() const; bool has_pending_inputs() const;
Client* get_client_ifp(StringView name); Client* get_client_ifp(StringView name);