1
1
mirror of https://github.com/mawww/kakoune.git synced 2024-11-28 17:13:00 +03:00

Do not add window pointing to deleted buffers in the free window list

Fixes #2975
This commit is contained in:
Maxime Coste 2019-06-16 19:04:06 +10:00
parent 9d52822702
commit 5888e23e02

View File

@ -137,6 +137,7 @@ void ClientManager::remove_client(Client& client, bool graceful, int status)
WindowAndSelections ClientManager::get_free_window(Buffer& buffer)
{
kak_assert(contains(BufferManager::instance(), &buffer));
auto it = find_if(m_free_windows | reverse(),
[&](const WindowAndSelections& ws)
{ return &ws.window->buffer() == &buffer; });
@ -153,6 +154,9 @@ WindowAndSelections ClientManager::get_free_window(Buffer& buffer)
void ClientManager::add_free_window(std::unique_ptr<Window>&& window, SelectionList selections)
{
if (not contains(BufferManager::instance(), &window->buffer()))
return;
window->clear_display_buffer();
m_free_windows.push_back({std::move(window), std::move(selections)});
}