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

BufferManager notify the ClientManager when a buffer dies

This commit is contained in:
Maxime Coste 2013-03-22 14:26:44 +01:00
parent 9494fbbd87
commit 5bba01ca9c
3 changed files with 8 additions and 1 deletions

View File

@ -4,6 +4,7 @@
#include "buffer.hh"
#include "exception.hh"
#include "string.hh"
#include "client_manager.hh"
namespace Kakoune
{
@ -35,6 +36,8 @@ void BufferManager::unregister_buffer(Buffer& buffer)
{
if (*it == &buffer)
{
if (ClientManager::has_instance())
ClientManager::instance().ensure_no_client_uses_buffer(buffer);
m_buffers.erase(it);
return;
}

View File

@ -234,7 +234,6 @@ void delete_buffer(const CommandParameters& params, Context& context)
if (manager.count() == 1)
throw runtime_error("buffer " + buffer.name() + " is the last one");
ClientManager::instance().ensure_no_client_uses_buffer(buffer);
delete &buffer;
}

View File

@ -33,6 +33,11 @@ public:
ms_instance = nullptr;
}
static bool has_instance()
{
return ms_instance != nullptr;
}
protected:
Singleton()
{