From 109c11f29c08f6592e53cb9e309e76d6619ee522 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Thu, 14 Jun 2012 13:15:30 +0000 Subject: [PATCH] BufferManager deletes remaining buffers in his destructor --- src/buffer_manager.cc | 7 +++++++ src/buffer_manager.hh | 2 ++ 2 files changed, 9 insertions(+) diff --git a/src/buffer_manager.cc b/src/buffer_manager.cc index e19c889cf..77c502886 100644 --- a/src/buffer_manager.cc +++ b/src/buffer_manager.cc @@ -9,6 +9,13 @@ namespace Kakoune 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) { assert(buffer); diff --git a/src/buffer_manager.hh b/src/buffer_manager.hh index e893d419e..beba66529 100644 --- a/src/buffer_manager.hh +++ b/src/buffer_manager.hh @@ -26,6 +26,8 @@ public: Buffer* operator->() const { return parent_type::operator*().second; } }; + ~BufferManager(); + void register_buffer(Buffer* buffer); void unregister_buffer(Buffer* buffer);