From e49c0fb04095a2a1c546fd033ce2a1a6df3eb8d0 Mon Sep 17 00:00:00 2001 From: Johannes Altmanninger Date: Sun, 14 May 2023 12:59:18 +0200 Subject: unmap: fail if the mapping is currently executing When unmapping a key sequence that is currently executing, we continue executing freed memory which can have weird effects. Let's instead throw an error if that happens. In future we can support unmap in this scenario. Closes #4896 --- src/input_handler.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/input_handler.cc') diff --git a/src/input_handler.cc b/src/input_handler.cc index 129a7e03..fb1d9ff6 100644 --- a/src/input_handler.cc +++ b/src/input_handler.cc @@ -1773,7 +1773,10 @@ void InputHandler::handle_key(Key key) if (keymaps.is_mapped(key, keymap_mode) and not m_context.keymaps_disabled()) { ScopedSetBool disable_history{context().history_disabled()}; - for (auto& k : keymaps.get_mapping(key, keymap_mode).keys) + + auto& mapping = keymaps.get_mapping(key, keymap_mode); + ScopedSetBool executing_mapping{mapping.is_executing}; + for (auto& k : mapping.keys) process_key(k); } else -- cgit v1.2.3