Prevent conversion to client on suspend from disconnecting other clients
clear the client manager in the to be converted process without sending exit messages as the forked server will still be there. Fixes #2847
This commit is contained in:
parent
f732ea4efb
commit
ef1fd3acb9
|
@ -21,7 +21,7 @@ BufferManager::~BufferManager()
|
|||
|
||||
// Make sure not clients exists
|
||||
if (ClientManager::has_instance())
|
||||
ClientManager::instance().clear();
|
||||
ClientManager::instance().clear(true);
|
||||
}
|
||||
|
||||
Buffer* BufferManager::create_buffer(String name, Buffer::Flags flags,
|
||||
|
|
|
@ -14,13 +14,18 @@ namespace Kakoune
|
|||
ClientManager::ClientManager() = default;
|
||||
ClientManager::~ClientManager()
|
||||
{
|
||||
clear();
|
||||
clear(true);
|
||||
}
|
||||
|
||||
void ClientManager::clear()
|
||||
void ClientManager::clear(bool disconnect_clients)
|
||||
{
|
||||
if (disconnect_clients)
|
||||
{
|
||||
while (not m_clients.empty())
|
||||
remove_client(*m_clients.front(), true, 0);
|
||||
}
|
||||
else
|
||||
m_clients.clear();
|
||||
m_client_trash.clear();
|
||||
|
||||
for (auto& window : m_free_windows)
|
||||
|
|
|
@ -27,7 +27,7 @@ public:
|
|||
bool empty() const { return m_clients.empty(); }
|
||||
size_t count() const { return m_clients.size(); }
|
||||
|
||||
void clear();
|
||||
void clear(bool exit);
|
||||
|
||||
void ensure_no_client_uses_buffer(Buffer& buffer);
|
||||
|
||||
|
|
|
@ -801,6 +801,7 @@ int run_server(StringView session, StringView server_init,
|
|||
|
||||
if (fork_server_to_background())
|
||||
{
|
||||
ClientManager::instance().clear(false);
|
||||
String session = server.session();
|
||||
server.close_session(false);
|
||||
throw convert_to_client_mode{ std::move(session), std::move(client_name), std::move(buffer_name), std::move(selections) };
|
||||
|
|
Loading…
Reference in New Issue
Block a user