Tweak BufferManager::delete_buffer implementation
This commit is contained in:
parent
fede8da14b
commit
182cc368a0
|
@ -58,19 +58,15 @@ void BufferManager::unregister_buffer(Buffer& buffer)
|
||||||
|
|
||||||
void BufferManager::delete_buffer(Buffer& buffer)
|
void BufferManager::delete_buffer(Buffer& buffer)
|
||||||
{
|
{
|
||||||
for (auto it = m_buffers.begin(); it != m_buffers.end(); ++it)
|
auto it = find_if(m_buffers, [&](const SafePtr<Buffer>& p)
|
||||||
{
|
{ return p.get() == &buffer; });
|
||||||
if (it->get() == &buffer)
|
kak_assert(it != m_buffers.end());
|
||||||
{
|
|
||||||
if (ClientManager::has_instance())
|
if (ClientManager::has_instance())
|
||||||
ClientManager::instance().ensure_no_client_uses_buffer(buffer);
|
ClientManager::instance().ensure_no_client_uses_buffer(buffer);
|
||||||
|
|
||||||
m_buffers.erase(it);
|
m_buffers.erase(it);
|
||||||
m_buffer_trash.emplace_back(&buffer);
|
m_buffer_trash.emplace_back(&buffer);
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
kak_assert(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Buffer* BufferManager::get_buffer_ifp(StringView name)
|
Buffer* BufferManager::get_buffer_ifp(StringView name)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user