diff options
| author | Johannes Altmanninger <aclopte@gmail.com> | 2024-12-13 08:24:21 +0100 |
|---|---|---|
| committer | Maxime Coste <mawww@kakoune.org> | 2025-06-26 11:23:40 +1000 |
| commit | f0f9d33243224d094e95750b860a636f9e3b0a99 (patch) | |
| tree | 4c1527bf32bd1b0473c7442da35441fee57bdcf5 /src/dynamic_buffer_iterator.cc | |
| parent | 6975285dade0d833457bcc36e1bf16d4d92cbb98 (diff) | |
Fix crash on redraw in BufCloseFifo hook
FifoWatcher::read_fifo() deletes the fifo watcher in
m_buffer.values().erase(fifo_watcher_id); // will delete this
which calls: HashMap::unordered_remove()
constexpr_swap(m_items[index], m_items.back());
destructor called here --> m_items.pop_back();
m_index.remove(hash, index);
So hash map invariants (of buffer.values()) are broken, when calling
~FifoWatcher which fires BufCloseFifo hooks. Things blow up if those
hooks access buffer.values() such as by accessing cached highlighters
to redraw the buffer. A shell call with a long sleep in the client
context seems to trigger this.
Fix this by destroying removed map items only at the end of
HashMap::remove(), when invariants are restored. Alternatively, we
could introduce a fifo_trash container; I haven't explored that.
Diffstat (limited to 'src/dynamic_buffer_iterator.cc')
0 files changed, 0 insertions, 0 deletions
