summaryrefslogtreecommitdiff
path: root/src/input_handler.cc
diff options
context:
space:
mode:
authorMaxime Coste <mawww@kakoune.org>2020-12-01 21:56:55 +1100
committerMaxime Coste <mawww@kakoune.org>2020-12-01 21:56:55 +1100
commit95606d23362cea6898f04d75a1483d928532af1e (patch)
tree5c3f3212279181dc2db309ebe3e14dc119f15b3f /src/input_handler.cc
parent586f79c30de2185a18f5f769e625184dd10fa40f (diff)
Avoid potential use after free of the mode name
This can be an issue with NextKey that now does not have a static mode name.
Diffstat (limited to 'src/input_handler.cc')
-rw-r--r--src/input_handler.cc1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/input_handler.cc b/src/input_handler.cc
index b7f83592..14f9240b 100644
--- a/src/input_handler.cc
+++ b/src/input_handler.cc
@@ -1596,6 +1596,7 @@ void InputHandler::pop_mode(InputMode* mode)
kak_assert(m_mode_stack.back().get() == mode);
kak_assert(m_mode_stack.size() > 1);
+ RefPtr<InputMode> keep_alive{mode}; // Ensure prev_name stays valid
StringView prev_name = mode->name();
current_mode().on_disabled(false);