mirror of
https://github.com/mawww/kakoune.git
synced 2024-12-24 20:13:00 +03:00
BufferManager notify the ClientManager when a buffer dies
This commit is contained in:
parent
9494fbbd87
commit
5bba01ca9c
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -33,6 +33,11 @@ public:
|
||||
ms_instance = nullptr;
|
||||
}
|
||||
|
||||
static bool has_instance()
|
||||
{
|
||||
return ms_instance != nullptr;
|
||||
}
|
||||
|
||||
protected:
|
||||
Singleton()
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user