Run ClientClose hook before exiting the client itself

Closes #2849
This commit is contained in:
Maxime Coste 2019-04-13 15:40:43 +10:00
parent 91337d6091
commit ac73f7c27f

View File

@ -123,13 +123,14 @@ void ClientManager::remove_client(Client& client, bool graceful, int status)
return;
}
client.exit(status);
m_client_trash.push_back(std::move(*it));
m_clients.erase(it);
auto& context = client.context();
context.hooks().run_hook(Hook::ClientClose, context.name(), context);
client.exit(status);
if (not graceful and m_clients.empty())
BufferManager::instance().backup_modified_buffers();
}