1
1
mirror of https://github.com/mawww/kakoune.git synced 2024-12-29 14:44:56 +03:00

Do not reuse m_buffer_trash to store dying buffers in ~BufferManager

Doing that clears m_buffer_trash, deleting buffers contained there,
but we are not ready to have Buffer destructors running yet as we
did not clear the ClientManager, meaning we might have free windows
pointing to buffers in the buffer trash.
This commit is contained in:
Maxime Coste 2018-05-21 20:30:24 +10:00
parent d4e36958f8
commit 56e2174cf6

View File

@ -13,11 +13,10 @@ namespace Kakoune
BufferManager::~BufferManager() BufferManager::~BufferManager()
{ {
// Move buffers to m_buffer_trash to avoid running BufClose // Move buffers to avoid running BufClose with buffers remaining in that list
// hook while clearing m_buffers BufferList buffers = std::move(m_buffers);
m_buffer_trash = std::move(m_buffers);
for (auto& buffer : m_buffer_trash) for (auto& buffer : buffers)
buffer->on_unregistered(); buffer->on_unregistered();
// Make sure not clients exists // Make sure not clients exists