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

pickers.lua crashes with invalid window id #2532

Closed
willocho opened this issue May 24, 2023 · 7 comments · Fixed by #2533 or #2538
Closed

pickers.lua crashes with invalid window id #2532

willocho opened this issue May 24, 2023 · 7 comments · Fixed by #2533 or #2538
Assignees
Labels
bug Something isn't working

Comments

@willocho
Copy link

Description

Pickers.lua crashes after a selection is made

Error executing vim.schedule lua callback: ...dein.vim/.cache/init.vim/.dein/lua/telescope/pickers.lua:756: Invalid window id: 1014
stack traceback:
        [C]: in function 'nvim_win_close'
        ...dein.vim/.cache/init.vim/.dein/lua/telescope/pickers.lua:756: in function 'close_windows'
        ...dein.vim/.cache/init.vim/.dein/lua/telescope/pickers.lua:1501: in function ''
        vim/_editor.lua: in function ''
        vim/_editor.lua: in function <vim/_editor.lua:0

Neovim version

NVIM v0.9.0
Build type: Release
LuaJIT 2.1.0-beta3

Operating system and version

6.1.29-1-MANJARO

Telescope version / branch / rev

9609686

checkhealth telescope

telescope: require("telescope.health").check()

Checking for required plugins ~
- OK plenary installed.
- OK nvim-treesitter installed.

Checking external dependencies ~
- OK rg: found ripgrep 13.0.0
- WARNING fd: not found. Install [sharkdp/fd](https://github.com/sharkdp/fd) for extended capabilities

===== Installed extensions ===== ~

Telescope Extension: `projects` ~
- No healthcheck provided


### Steps to reproduce

1. Checkout the commit provided
2. Open a window picker
3. Select an option
4. You'll see the stack trace

### Expected behavior

_No response_

### Actual behavior

The program crashes. Based on the stack trace it appears that the window closing is deferred, but by the time the deferred function closes the window it's already closed, hence the crash

### Minimal config

```Lua
vim.cmd [[set runtimepath=$VIMRUNTIME]]
vim.cmd [[set packpath=/tmp/nvim/site]]
local package_root = '/tmp/nvim/site/pack'
local install_path = package_root .. '/packer/start/packer.nvim'
local function load_plugins()
  require('packer').startup {
    {
      'wbthomason/packer.nvim',
      {
        'nvim-telescope/telescope.nvim',
        requires = {
          'nvim-lua/plenary.nvim',
          { 'nvim-telescope/telescope-fzf-native.nvim', run = 'make' },
        },
      },
      -- ADD PLUGINS THAT ARE _NECESSARY_ FOR REPRODUCING THE ISSUE
    },
    config = {
      package_root = package_root,
      compile_path = install_path .. '/plugin/packer_compiled.lua',
      display = { non_interactive = true },
    },
  }
end
_G.load_config = function()
  require('telescope').setup()
  require('telescope').load_extension('fzf')
end
if vim.fn.isdirectory(install_path) == 0 then
  print("Installing Telescope and dependencies.")
  vim.fn.system { 'git', 'clone', '--depth=1', 'https://github.com/wbthomason/packer.nvim', install_path }
end
load_plugins()
require('packer').sync()
vim.cmd [[autocmd User PackerComplete ++once echo "Ready!" | lua load_config()]]
@willocho willocho added the bug Something isn't working label May 24, 2023
@Conni2461
Copy link
Member

can you confirm that this issue was introduced by 3f1b579 ? i didn't see any regression but it touched some really flaky code so i hesitated for some time merging that PR, even though it fixed another issue

@Conni2461
Copy link
Member

and #2533 might fix the issue, i sadly cant reproduce it, so i would appreciate it, if you could test it

@willocho
Copy link
Author

I can confirm that it was caused by 3f1b579. I just tried the parent and it works.

Your fix also works. Thanks a lot!

@Conni2461
Copy link
Member

thanks for testing :)

@willocho
Copy link
Author

Sorry about this, but after testing some more, this fix actually introduces a new issue. The specific plugin I'm using is ahmedkhalf/project.nvim. The new issue is that the window doesn't crash, but when I select a file the picker closes without actually opening the file.

@Conni2461
Copy link
Member

big uff. does this only happen with project.nvim? and not with builtins?

its already late (10:50pm) so i am gonna look into this tomorrow, hopefully i can fix it otherwise i would need to revert :(

@Conni2461 Conni2461 reopened this May 24, 2023
@Conni2461 Conni2461 self-assigned this May 24, 2023
@athanase
Copy link

Hello,

Same issue for me with two other session manager plugins:
https://github.com/olimorris/persisted.nvim
https://github.com/aaditeynair/conduct.nvim

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
3 participants