summaryrefslogtreecommitdiff
path: root/src/input_handler.cc
diff options
context:
space:
mode:
authorJohannes Altmanninger <aclopte@gmail.com>2023-05-14 12:59:18 +0200
committerJohannes Altmanninger <aclopte@gmail.com>2023-05-25 00:04:23 +0200
commite49c0fb04095a2a1c546fd033ce2a1a6df3eb8d0 (patch)
tree2c3a229a467aaf9b8d4f864186938c85cd3d0914 /src/input_handler.cc
parentcfa658b899b44a8a0f4c7f3dd9811ae0d44ddd3a (diff)
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
Diffstat (limited to 'src/input_handler.cc')
-rw-r--r--src/input_handler.cc5
1 files changed, 4 insertions, 1 deletions
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