diff options
| author | Maxime Coste <mawww@kakoune.org> | 2025-06-03 09:26:15 +1000 |
|---|---|---|
| committer | Maxime Coste <mawww@kakoune.org> | 2025-06-03 09:26:15 +1000 |
| commit | c7a7c35963133c0d57dc2abe341dac6c7763b19c (patch) | |
| tree | e63dea1056c1bab318e8aacfa6e33f3b3cf3a6f4 /src/buffer.hh | |
| parent | ccb3090361103368ed57d628b5922e18a49fc604 (diff) | |
Prevent deletion of buffers while creating new windows
`kak -n -E 'hook global WinCreate .* %{ delete-buffer }'` was crashing
because we would delete the buffer during window construction, which
would not be able to delete the window as it was not fully constructed
and registered yet. This led to a window referencing a deleted buffer.
Fixing this by deleting the window later on failed because we can enter
an infinite loop where we constantly create a new *scratch* buffer, then
a window to display it, which deletes that buffer.
Make it an error to try to delete a buffer while a new window is
being setup by adding a Locked flag to buffers and checking that in
BufferManager::delete_buffer
Fixes #5311
Diffstat (limited to 'src/buffer.hh')
| -rw-r--r-- | src/buffer.hh | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/buffer.hh b/src/buffer.hh index 3a885ec8..2bcd8cc3 100644 --- a/src/buffer.hh +++ b/src/buffer.hh @@ -121,6 +121,7 @@ public: Debug = 1 << 5, ReadOnly = 1 << 6, NoBufSetOption = 1 << 7, + Locked = 1 << 8, }; friend constexpr bool with_bit_ops(Meta::Type<Flags>) { return true; } friend class BufferIterator; |
