From d5fc4454551d4d9ee462d1291057a016fbfe3882 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Fri, 23 May 2025 10:14:09 +1000 Subject: Disable BufSetOption hook during buffer registration The hook is manually triggred at the end of registration, by disabling it we avoid the hook being potentially called multiple times due to interaction with other hooks. Fixes #5324 --- src/buffer.cc | 6 ++++++ src/buffer.hh | 1 + 2 files changed, 7 insertions(+) (limited to 'src') diff --git a/src/buffer.cc b/src/buffer.cc index f0205c54..9a735aaf 100644 --- a/src/buffer.cc +++ b/src/buffer.cc @@ -70,6 +70,8 @@ void Buffer::on_registered() return; } + m_flags |= Flags::NoBufSetOption; + run_hook_in_own_context(Hook::BufCreate, m_name); if (m_flags & Flags::File) @@ -82,6 +84,7 @@ void Buffer::on_registered() run_hook_in_own_context(Hook::BufOpenFile, m_name); } } + m_flags &= ~Flags::NoBufSetOption; for (auto& option : options().flatten_options() | transform(&std::unique_ptr