diff --git a/src/option_manager.cc b/src/option_manager.cc index 7c98daff..c510dff8 100644 --- a/src/option_manager.cc +++ b/src/option_manager.cc @@ -26,13 +26,13 @@ OptionManager::~OptionManager() kak_assert(m_watchers.empty()); } -void OptionManager::register_watcher(OptionManagerWatcher& watcher) +void OptionManager::register_watcher(OptionManagerWatcher& watcher) const { kak_assert(not contains(m_watchers, &watcher)); m_watchers.push_back(&watcher); } -void OptionManager::unregister_watcher(OptionManagerWatcher& watcher) +void OptionManager::unregister_watcher(OptionManagerWatcher& watcher) const { auto it = find(m_watchers.begin(), m_watchers.end(), &watcher); kak_assert(it != m_watchers.end()); diff --git a/src/option_manager.hh b/src/option_manager.hh index d4d50daf..cff6f34f 100644 --- a/src/option_manager.hh +++ b/src/option_manager.hh @@ -91,8 +91,8 @@ public: using OptionList = Vector; OptionList flatten_options() const; - void register_watcher(OptionManagerWatcher& watcher); - void unregister_watcher(OptionManagerWatcher& watcher); + void register_watcher(OptionManagerWatcher& watcher) const; + void unregister_watcher(OptionManagerWatcher& watcher) const; void on_option_changed(const Option& option) override; private: @@ -105,7 +105,7 @@ private: Vector, MemoryDomain::Options> m_options; OptionManager* m_parent; - Vector m_watchers; + mutable Vector m_watchers; }; template