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.
This commit is contained in:
Maxime Coste 2020-12-01 21:56:55 +11:00
parent 586f79c30d
commit 95606d2336

View File

@ -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);