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
|
// Make sure not clients exists
|
||||||
if (ClientManager::has_instance())
|
if (ClientManager::has_instance())
|
||||||
ClientManager::instance().clear();
|
ClientManager::instance().clear(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
Buffer* BufferManager::create_buffer(String name, Buffer::Flags flags,
|
Buffer* BufferManager::create_buffer(String name, Buffer::Flags flags,
|
||||||
|
|
|
@ -14,13 +14,18 @@ namespace Kakoune
|
||||||
ClientManager::ClientManager() = default;
|
ClientManager::ClientManager() = default;
|
||||||
ClientManager::~ClientManager()
|
ClientManager::~ClientManager()
|
||||||
{
|
{
|
||||||
clear();
|
clear(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClientManager::clear()
|
void ClientManager::clear(bool disconnect_clients)
|
||||||
{
|
{
|
||||||
while (not m_clients.empty())
|
if (disconnect_clients)
|
||||||
remove_client(*m_clients.front(), true, 0);
|
{
|
||||||
|
while (not m_clients.empty())
|
||||||
|
remove_client(*m_clients.front(), true, 0);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
m_clients.clear();
|
||||||
m_client_trash.clear();
|
m_client_trash.clear();
|
||||||
|
|
||||||
for (auto& window : m_free_windows)
|
for (auto& window : m_free_windows)
|
||||||
|
|
|
@ -27,7 +27,7 @@ public:
|
||||||
bool empty() const { return m_clients.empty(); }
|
bool empty() const { return m_clients.empty(); }
|
||||||
size_t count() const { return m_clients.size(); }
|
size_t count() const { return m_clients.size(); }
|
||||||
|
|
||||||
void clear();
|
void clear(bool exit);
|
||||||
|
|
||||||
void ensure_no_client_uses_buffer(Buffer& buffer);
|
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())
|
if (fork_server_to_background())
|
||||||
{
|
{
|
||||||
|
ClientManager::instance().clear(false);
|
||||||
String session = server.session();
|
String session = server.session();
|
||||||
server.close_session(false);
|
server.close_session(false);
|
||||||
throw convert_to_client_mode{ std::move(session), std::move(client_name), std::move(buffer_name), std::move(selections) };
|
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