buffer: Remove buffer invalidation in CloseOpenBuffers()#4133
Open
JoeKar wants to merge 1 commit into
Open
Conversation
Shared()CloseOpenBuffers()
The invalidation was introduced with micro-editor#2898 to workaround the same root cause: OpenBuffers is modified in Close() while the iteration is ongoing. This causes not closed buffers. We solve this situation by using a local copy of OpenBuffers to do the necessary iteration. The modification is still done by Close(). Additional functions don't have to check for nil'ed buffers.
dmaluka
reviewed
Jul 7, 2026
| @@ -502,11 +502,14 @@ func NewBuffer(r io.Reader, size int64, path string, btype BufType, cmd Command) | |||
|
|
|||
Collaborator
There was a problem hiding this comment.
The commit message, again, sounds confusing:
to workaround the same root cause
The root cause of what? The same as what?
The modification is still done by Close().
"still"? Before this commit it wasn't done by Close(), was it?
Why not clearly say that this fixes #4131, and in order to avoid reintroducing the issue fixed by #2898, uses a local copy?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The invalidation was introduced with #2898 to workaround the same root cause:
OpenBuffersis modified inClose()while the iteration is ongoing. This causesnot closed buffers.
We solve this situation by using a local copy of
OpenBuffersto do the necessaryiteration. The modification is still done by
Close().Additional functions don't have to check for
nil'ed buffers.Fixes #4131