From 0a833371ab7af35c5e574431056e86fe71526d50 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Tue, 27 Mar 2018 07:40:44 +1100 Subject: [PATCH] Prompt: Do not call callback in on_enabled Schedule it for later, when we get "idle". It currently can lead to crashed because after the callback, the current mode might be different, leading to a crash when doing the ModeChange hook call. --- src/input_handler.cc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/input_handler.cc b/src/input_handler.cc index 20228dd1..8592e94d 100644 --- a/src/input_handler.cc +++ b/src/input_handler.cc @@ -968,8 +968,7 @@ private: void on_enabled() override { display(); - m_line_changed = false; - m_callback(m_line_editor.line(), PromptEvent::Change, context()); + m_line_changed = true; if (not (context().flags() & Context::Flags::Transient)) m_idle_timer.set_next_date(Clock::now() + get_idle_timeout(context()));