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:
parent
713fa9d406
commit
533079c389
@ -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);
|
||||
}
|
||||
|
@ -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)
|
||||
|
@ -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{};
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user