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:
parent
9494fbbd87
commit
5bba01ca9c
@ -4,6 +4,7 @@
|
|||||||
#include "buffer.hh"
|
#include "buffer.hh"
|
||||||
#include "exception.hh"
|
#include "exception.hh"
|
||||||
#include "string.hh"
|
#include "string.hh"
|
||||||
|
#include "client_manager.hh"
|
||||||
|
|
||||||
namespace Kakoune
|
namespace Kakoune
|
||||||
{
|
{
|
||||||
@ -35,6 +36,8 @@ void BufferManager::unregister_buffer(Buffer& buffer)
|
|||||||
{
|
{
|
||||||
if (*it == &buffer)
|
if (*it == &buffer)
|
||||||
{
|
{
|
||||||
|
if (ClientManager::has_instance())
|
||||||
|
ClientManager::instance().ensure_no_client_uses_buffer(buffer);
|
||||||
m_buffers.erase(it);
|
m_buffers.erase(it);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -234,7 +234,6 @@ void delete_buffer(const CommandParameters& params, Context& context)
|
|||||||
if (manager.count() == 1)
|
if (manager.count() == 1)
|
||||||
throw runtime_error("buffer " + buffer.name() + " is the last one");
|
throw runtime_error("buffer " + buffer.name() + " is the last one");
|
||||||
|
|
||||||
ClientManager::instance().ensure_no_client_uses_buffer(buffer);
|
|
||||||
delete &buffer;
|
delete &buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,6 +33,11 @@ public:
|
|||||||
ms_instance = nullptr;
|
ms_instance = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool has_instance()
|
||||||
|
{
|
||||||
|
return ms_instance != nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
Singleton()
|
Singleton()
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user