From 533079c38916a0c93a4b36e3385223856ca95524 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Tue, 20 Nov 2012 18:54:35 +0100 Subject: [PATCH] Let client manager handle deleting client --- src/client_manager.cc | 1 + src/client_manager.hh | 3 ++- src/commands.cc | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/client_manager.cc b/src/client_manager.cc index c2a7dcce..5dadc45f 100644 --- a/src/client_manager.cc +++ b/src/client_manager.cc @@ -25,6 +25,7 @@ void ClientManager::create_client(std::unique_ptr&& ui, } catch (Kakoune::client_removed&) { + ClientManager::instance().remove_client_by_context(*context); EventManager::instance().unwatch(fd); close(fd); } diff --git a/src/client_manager.hh b/src/client_manager.hh index 131c68cf..d4b78480 100644 --- a/src/client_manager.hh +++ b/src/client_manager.hh @@ -14,7 +14,6 @@ class ClientManager : public Singleton public: void create_client(std::unique_ptr&& ui, Buffer& buffer, int event_fd); - void remove_client_by_context(Context& context); bool empty() const { return m_clients.empty(); } size_t count() const { return m_clients.size(); } @@ -24,6 +23,8 @@ public: void redraw_clients() const; private: + void remove_client_by_context(Context& context); + struct Client { Client(std::unique_ptr&& ui, Window& window) diff --git a/src/commands.cc b/src/commands.cc index 899b4fd4..2712722b 100644 --- a/src/commands.cc +++ b/src/commands.cc @@ -363,7 +363,7 @@ void quit(const CommandParameters& params, Context& context) throw runtime_error(message); } } - ClientManager::instance().remove_client_by_context(context); + // unwind back to this client event handler. throw client_removed{}; }