diff --git a/src/buffer.cc b/src/buffer.cc index 33f2ae3b..81e63b95 100644 --- a/src/buffer.cc +++ b/src/buffer.cc @@ -249,14 +249,14 @@ void Buffer::notify_saved() m_last_save_undo_index = history_cursor_index; } -void Buffer::register_modification_listener(BufferModificationListener* listener) const +void Buffer::register_modification_listener(BufferModificationListener* listener) { assert(listener); assert(not contains(m_modification_listeners, listener)); m_modification_listeners.push_back(listener); } -void Buffer::unregister_modification_listener(BufferModificationListener* listener) const +void Buffer::unregister_modification_listener(BufferModificationListener* listener) { assert(listener); auto it = std::find(m_modification_listeners.begin(), diff --git a/src/buffer.hh b/src/buffer.hh index be0e0d47..35572a2d 100644 --- a/src/buffer.hh +++ b/src/buffer.hh @@ -146,8 +146,8 @@ public: Type type() const { return m_type; } void notify_saved(); - void register_modification_listener(BufferModificationListener* listener) const; - void unregister_modification_listener(BufferModificationListener* listener) const; + void register_modification_listener(BufferModificationListener* listener); + void unregister_modification_listener(BufferModificationListener* listener); private: BufferChar at(BufferPos position) const; @@ -180,7 +180,7 @@ private: size_t m_last_save_undo_index; - mutable std::vector m_modification_listeners; + std::vector m_modification_listeners; }; } diff --git a/src/dynamic_buffer_iterator.cc b/src/dynamic_buffer_iterator.cc index 42c9d39c..fac3cd39 100644 --- a/src/dynamic_buffer_iterator.cc +++ b/src/dynamic_buffer_iterator.cc @@ -59,13 +59,13 @@ void DynamicBufferIterator::on_modification(const BufferModification& modificati void DynamicBufferIterator::register_ifp() { if (is_valid()) - buffer().register_modification_listener(this); + const_cast(buffer()).register_modification_listener(this); } void DynamicBufferIterator::unregister_ifn() { if (is_valid()) - buffer().unregister_modification_listener(this); + const_cast(buffer()).unregister_modification_listener(this); } }