Fix crash when iterating through options on window creation

Window::on_option_changed calls hooks, which can do anything
including adding/removing options in the various option managers

Fixes #1863
This commit is contained in:
Maxime Coste 2018-02-21 22:47:41 +11:00
parent 69a0ad09b4
commit 35d68d2f82

View File

@ -30,7 +30,10 @@ Window::Window(Buffer& buffer)
setup_builtin_highlighters(m_builtin_highlighters.group()); setup_builtin_highlighters(m_builtin_highlighters.group());
for (auto& option : options().flatten_options()) // gather as on_option_changed can mutate the option managers
for (auto& option : options().flatten_options()
| transform([](auto& ptr) { return ptr.get(); })
| gather<Vector<const Option*>>())
on_option_changed(*option); on_option_changed(*option);
} }