BufferManager deletes remaining buffers in his destructor

This commit is contained in:
Maxime Coste 2012-06-14 13:15:30 +00:00
parent be47802058
commit 109c11f29c
2 changed files with 9 additions and 0 deletions

View File

@ -9,6 +9,13 @@ namespace Kakoune
struct name_not_unique : logic_error {}; struct name_not_unique : logic_error {};
BufferManager::~BufferManager()
{
// delete remaining buffers
while (not m_buffers.empty())
delete m_buffers.begin()->second;
}
void BufferManager::register_buffer(Buffer* buffer) void BufferManager::register_buffer(Buffer* buffer)
{ {
assert(buffer); assert(buffer);

View File

@ -26,6 +26,8 @@ public:
Buffer* operator->() const { return parent_type::operator*().second; } Buffer* operator->() const { return parent_type::operator*().second; }
}; };
~BufferManager();
void register_buffer(Buffer* buffer); void register_buffer(Buffer* buffer);
void unregister_buffer(Buffer* buffer); void unregister_buffer(Buffer* buffer);