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:
parent
d4e36958f8
commit
56e2174cf6
|
@ -13,11 +13,10 @@ namespace Kakoune
|
|||
|
||||
BufferManager::~BufferManager()
|
||||
{
|
||||
// Move buffers to m_buffer_trash to avoid running BufClose
|
||||
// hook while clearing m_buffers
|
||||
m_buffer_trash = std::move(m_buffers);
|
||||
// Move buffers to avoid running BufClose with buffers remaining in that list
|
||||
BufferList buffers = std::move(m_buffers);
|
||||
|
||||
for (auto& buffer : m_buffer_trash)
|
||||
for (auto& buffer : buffers)
|
||||
buffer->on_unregistered();
|
||||
|
||||
// Make sure not clients exists
|
||||
|
|
Loading…
Reference in New Issue
Block a user