diff options
| author | Maxime Coste <mawww@kakoune.org> | 2019-06-16 19:04:06 +1000 |
|---|---|---|
| committer | Maxime Coste <mawww@kakoune.org> | 2019-06-16 19:12:35 +1000 |
| commit | 5888e23e020ac3fd56a93c75682a216bd7085593 (patch) | |
| tree | 072bc2119da32dcc21d9c5883c9fee14af2aa84f /src/client_manager.cc | |
| parent | 9d528227021e14806394971c797c6e5a1fbc1b69 (diff) | |
Do not add window pointing to deleted buffers in the free window list
Fixes #2975
Diffstat (limited to 'src/client_manager.cc')
| -rw-r--r-- | src/client_manager.cc | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/client_manager.cc b/src/client_manager.cc index a3426a04..b1d6c6f2 100644 --- a/src/client_manager.cc +++ b/src/client_manager.cc @@ -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)}); } |
