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.
This commit is contained in:
Maxime Coste 2018-03-27 07:40:44 +11:00
parent 3d3a37a80c
commit 0a833371ab

View File

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