1
1
mirror of https://github.com/mawww/kakoune.git synced 2024-12-24 20:13:00 +03:00

Let client manager handle deleting client

This commit is contained in:
Maxime Coste 2012-11-20 18:54:35 +01:00
parent 713fa9d406
commit 533079c389
3 changed files with 4 additions and 2 deletions

View File

@ -25,6 +25,7 @@ void ClientManager::create_client(std::unique_ptr<UserInterface>&& ui,
}
catch (Kakoune::client_removed&)
{
ClientManager::instance().remove_client_by_context(*context);
EventManager::instance().unwatch(fd);
close(fd);
}

View File

@ -14,7 +14,6 @@ class ClientManager : public Singleton<ClientManager>
public:
void create_client(std::unique_ptr<UserInterface>&& 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<UserInterface>&& ui, Window& window)

View File

@ -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{};
}