Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: check if the buffer is still loaded before calling nvim_buf_attach #640

Merged
merged 1 commit into from
Oct 6, 2022

Conversation

JafarAbdi
Copy link
Contributor

I'm getting the following error when calling bwipeout on a buffer, so this PR fixes it.

Not sure if this's the best solution since we already have another check gitsigns.tl#L209-L212 in the same function.

Error executing vim.schedule lua callback: ...e/pack/packer/start/gitsigns.nvim/lua/gitsigns/async.lua:62: The coroutine failed with this message: ...im/site/pack/packer/start/gitsigns.nvim/lua/gitsigns.lua:294: Invalid buffer id: 5
stack traceback:
        [C]: in function 'nvim_buf_attach'
        ...im/site/pack/packer/start/gitsigns.nvim/lua/gitsigns.lua:294: in function 'fn'
        ...ack/packer/start/gitsigns.nvim/lua/gitsigns/debounce.lua:78: in function 'attach_throttled'
        ...im/site/pack/packer/start/gitsigns.nvim/lua/gitsigns.lua:316: in function <...im/site/pack/packer/start/gitsigns.nvim/lua/gitsigns.lua:315>
stack traceback:
        [C]: in function 'error'
        ...e/pack/packer/start/gitsigns.nvim/lua/gitsigns/async.lua:62: in function <...e/pack/packer/start/gitsigns.nvim/lua/gitsigns/async.lua:57>

@JafarAbdi JafarAbdi changed the title Check if the buffer is still loaded before calling nvim_buf_attach Fix: check if the buffer is still loaded before calling nvim_buf_attach Oct 5, 2022
@lewis6991
Copy link
Owner

This can happen because there is async code between the check you mentioned and the buffer attaching.

Might not be the most ideal solution, but we can merge it for now.

@lewis6991 lewis6991 merged commit fe76eed into lewis6991:main Oct 6, 2022
@JafarAbdi JafarAbdi deleted the pr-check_buf_is_loaded branch October 6, 2022 12:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants