1
1
mirror of https://github.com/mawww/kakoune.git synced 2024-12-25 20:41:49 +03:00

BufferManager should outlive ClientManager in the end

If not, clients end up keeping references on a buffer while
it it being deleted.
This commit is contained in:
Maxime Coste 2016-03-02 20:27:47 +00:00
parent 2df7b1f6da
commit 67849f2db7
3 changed files with 3 additions and 12 deletions

View File

@ -16,21 +16,13 @@ struct name_not_unique : runtime_error
name_not_unique() : runtime_error("buffer name is already in use") {}
};
BufferManager::BufferManager()
{
kak_assert(ClientManager::has_instance());
}
BufferManager::~BufferManager()
{
kak_assert(ClientManager::has_instance());
kak_assert(not ClientManager::has_instance());
// delete remaining buffers
while (not m_buffers.empty())
{
ClientManager::instance().ensure_no_client_uses_buffer(*m_buffers.front().get());
delete m_buffers.front().get();
}
}
void BufferManager::register_buffer(Buffer& buffer)

View File

@ -16,7 +16,6 @@ public:
using BufferList = Vector<SafePtr<Buffer>>;
using iterator = BufferList::const_iterator;
BufferManager();
~BufferManager();
void register_buffer(Buffer& buffer);

View File

@ -463,8 +463,8 @@ int run_server(StringView session, StringView init_command,
HighlighterRegistry highlighter_registry;
DefinedHighlighters defined_highlighters;
FaceRegistry face_registry;
ClientManager client_manager;
BufferManager buffer_manager;
ClientManager client_manager;
register_options();
register_env_vars();
@ -590,8 +590,8 @@ int run_filter(StringView keystr, StringView commands, ConstArrayView<StringView
ShellManager shell_manager;
CommandManager command_manager;
RegisterManager register_manager;
ClientManager client_manager;
BufferManager buffer_manager;
ClientManager client_manager;
register_options();
register_env_vars();