BufferManager: Support missing ClientManager
This commit is contained in:
parent
10c6c59a26
commit
d9cddf41f2
|
@ -21,6 +21,7 @@ BufferManager::~BufferManager()
|
||||||
buffer->on_unregistered();
|
buffer->on_unregistered();
|
||||||
|
|
||||||
// Make sure not clients exists
|
// Make sure not clients exists
|
||||||
|
if (ClientManager::has_instance())
|
||||||
ClientManager::instance().clear();
|
ClientManager::instance().clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -55,6 +56,7 @@ void BufferManager::delete_buffer(Buffer& buffer)
|
||||||
m_buffer_trash.emplace_back(std::move(*it));
|
m_buffer_trash.emplace_back(std::move(*it));
|
||||||
m_buffers.erase(it);
|
m_buffers.erase(it);
|
||||||
|
|
||||||
|
if (ClientManager::has_instance())
|
||||||
ClientManager::instance().ensure_no_client_uses_buffer(buffer);
|
ClientManager::instance().ensure_no_client_uses_buffer(buffer);
|
||||||
|
|
||||||
buffer.on_unregistered();
|
buffer.on_unregistered();
|
||||||
|
@ -105,8 +107,11 @@ void BufferManager::clear_buffer_trash()
|
||||||
{
|
{
|
||||||
// Do that again, to be tolerant in some corner cases, where a buffer is
|
// Do that again, to be tolerant in some corner cases, where a buffer is
|
||||||
// deleted during its creation
|
// deleted during its creation
|
||||||
|
if (ClientManager::has_instance())
|
||||||
|
{
|
||||||
ClientManager::instance().ensure_no_client_uses_buffer(*buffer);
|
ClientManager::instance().ensure_no_client_uses_buffer(*buffer);
|
||||||
ClientManager::instance().clear_window_trash();
|
ClientManager::instance().clear_window_trash();
|
||||||
|
}
|
||||||
|
|
||||||
buffer.reset();
|
buffer.reset();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user