Fix buffer deletion logic
'eval -buffer * db' was failing in certain cases
This commit is contained in:
parent
a7a2e51d52
commit
dfe3098b18
|
@ -134,6 +134,7 @@ void ClientManager::ensure_no_client_uses_buffer(Buffer& buffer)
|
|||
if (buf.get() != &buffer)
|
||||
{
|
||||
client->context().change_buffer(*buf);
|
||||
client->set_last_buffer(nullptr);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1288,8 +1288,14 @@ void context_wrap(const ParametersParser& parser, Context& context, Func func)
|
|||
func(parser, c);
|
||||
};
|
||||
if (*bufnames == "*")
|
||||
for (auto buffer : BufferManager::instance())
|
||||
{
|
||||
// copy buffer list as we might be mutating the buffer list
|
||||
// in the loop.
|
||||
Vector<SafePtr<Buffer>> buffers{BufferManager::instance().begin(),
|
||||
BufferManager::instance().end()};
|
||||
for (auto buffer : buffers)
|
||||
context_wrap_for_buffer(*buffer);
|
||||
}
|
||||
else
|
||||
for (auto& name : split(*bufnames, ','))
|
||||
context_wrap_for_buffer(BufferManager::instance().get_buffer(name));
|
||||
|
|
Loading…
Reference in New Issue
Block a user