diff options
| author | Maxime Coste <mawww@kakoune.org> | 2018-02-21 22:47:41 +1100 |
|---|---|---|
| committer | Maxime Coste <mawww@kakoune.org> | 2018-02-21 22:47:41 +1100 |
| commit | 35d68d2f82d42c2b0947f2a298c8658e6ad22df8 (patch) | |
| tree | d9bc7acd6295e0a531f013e8493ac65afde3c307 /src/window.cc | |
| parent | 69a0ad09b4c3e8352f5a01826c9f5528980950c7 (diff) | |
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
Diffstat (limited to 'src/window.cc')
| -rw-r--r-- | src/window.cc | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/window.cc b/src/window.cc index b64d0fae..d0e0ff85 100644 --- a/src/window.cc +++ b/src/window.cc @@ -30,7 +30,10 @@ Window::Window(Buffer& buffer) 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); } |
