ctrlsf.vim
ctrlsf.vim copied to clipboard
"free(): invalid pointer" when doing async searches with neovim
Issue description
Its not always, but I noticed that when you try doing a search that will result in a lot of entries, it first displays a weird error (its gigantic, so I will paste it below), and then it starts the async search, and whenever I switch to the search buffer, my normal buffer gets replaced with the same contents as the search buffer (minus highlighting, image showing this below), and whenever I try to close any of the buffers (by doing :bd
or :q
), neovim crashes and the following message appears on the console:
the neovim crash
free(): invalid pointer
zsh: abort (core dumped) nvim
%
the buffer being replaced with a copy of the search buffer (it updates whenever the search buffer updates as well):
the gigantic first error:
line 2:
E315: ml_get: invalid lnum: 319
Error detected while processing function ctrlsf#async#ParseAndDrawCB[7]..ctrlsf#win#DrawIncr[11]..ctrlsf#buf#SetLine[4]..<SNR>99_setbufline:
line 2:
E315: ml_get: invalid lnum: 319
Error detected while processing function ctrlsf#async#ParseAndDrawCB[7]..ctrlsf#win#DrawIncr[11]..ctrlsf#buf#SetLine[4]..<SNR>99_setbufline:
line 2:
E315: ml_get: invalid lnum: 318
Error detected while processing function ctrlsf#async#NeoVimSearchCBWrapper:
line 7:
E16: Invalid range: call remove(a:data, -1)
Error detected while processing function ctrlsf#async#NeoVimSearchCBWrapper:
line 7:
E16: Invalid range: call remove(a:data, -1)
Error detected while processing function ctrlsf#async#NeoVimSearchCBWrapper:
line 7:
E16: Invalid range: call remove(a:data, -1)
Error detected while processing function <SNR>81_illuminate:
line 5:
E16: Invalid range: call s:remove_illumination()
Error detected while processing function ctrlsf#async#ParseAndDrawCB:
line 2:
E16: Invalid range: call ctrlsf#log#Debug("ConsumeResult: size=%s", len(lines))
Error detected while processing function ctrlsf#async#NeoVimSearchCBWrapper:
line 2:
E16: Invalid range: call ctrlsf#async#SearchCloseCB('unused')
E315: ml_get: invalid lnum: 285
E315: ml_get: invalid lnum: 286
E315: ml_get: invalid lnum: 287
E315: ml_get: invalid lnum: 288
E315: ml_get: invalid lnum: 289
E315: ml_get: invalid lnum: 290
E315: ml_get: invalid lnum: 291
E315: ml_get: invalid lnum: 292
E315: ml_get: invalid lnum: 293
E315: ml_get: invalid lnum: 294
E315: ml_get: invalid lnum: 295
E315: ml_get: invalid lnum: 296
E315: ml_get: invalid lnum: 297
E315: ml_get: invalid lnum: 298
E315: ml_get: invalid lnum: 299
E315: ml_get: invalid lnum: 300
E315: ml_get: invalid lnum: 301
E315: ml_get: invalid lnum: 302
E315: ml_get: invalid lnum: 303
E315: ml_get: invalid lnum: 304
E315: ml_get: invalid lnum: 305
E315: ml_get: invalid lnum: 306
E315: ml_get: invalid lnum: 307
E315: ml_get: invalid lnum: 308
E315: ml_get: invalid lnum: 309
E315: ml_get: invalid lnum: 310
E315: ml_get: invalid lnum: 311
E315: ml_get: invalid lnum: 312
E315: ml_get: invalid lnum: 313
E315: ml_get: invalid lnum: 314
E315: ml_get: invalid lnum: 315
E315: ml_get: invalid lnum: 316
E315: ml_get: invalid lnum: 317
E315: ml_get: invalid lnum: 318
E315: ml_get: invalid lnum: 319
E315: ml_get: invalid lnum: 285
E315: ml_get: invalid lnum: 286
E315: ml_get: invalid lnum: 287
E315: ml_get: invalid lnum: 288
E315: ml_get: invalid lnum: 289
E315: ml_get: invalid lnum: 290
E315: ml_get: invalid lnum: 291
E315: ml_get: invalid lnum: 292
E315: ml_get: invalid lnum: 293
E315: ml_get: invalid lnum: 294
E315: ml_get: invalid lnum: 295
E315: ml_get: invalid lnum: 296
E315: ml_get: invalid lnum: 297
E315: ml_get: invalid lnum: 298
E315: ml_get: invalid lnum: 299
E315: ml_get: invalid lnum: 300
E315: ml_get: invalid lnum: 301
E315: ml_get: invalid lnum: 302
E315: ml_get: invalid lnum: 303
E315: ml_get: invalid lnum: 304
E315: ml_get: invalid lnum: 305
E315: ml_get: invalid lnum: 306
E315: ml_get: invalid lnum: 307
E315: ml_get: invalid lnum: 308
E315: ml_get: invalid lnum: 309
E315: ml_get: invalid lnum: 310
E315: ml_get: invalid lnum: 311
E315: ml_get: invalid lnum: 312
E315: ml_get: invalid lnum: 313
E315: ml_get: invalid lnum: 314
E315: ml_get: invalid lnum: 315
E315: ml_get: invalid lnum: 316
E315: ml_get: invalid lnum: 317
E315: ml_get: invalid lnum: 318
E315: ml_get: invalid lnum: 319
Things about your system and environment
field | value |
---|---|
os | OS X Monterey 12.2.1 |
vim | NVIM v0.7.0 |
backend | ripgrep 13.0.0 |
locale | en_US.UTF-8 |
- log:
Its difficult to post the log, as there's a lot of private code as well in there... If there's anything in specific, I can try to search for it
- vimrc:
let g:ctrlsf_ackprg = 'rg'
let g:ctrlsf_auto_focus = {
\ "at": "done",
\ "duration_less_than": 1000
\ }
let g:ctrlsf_mapping = {
\ "next": "n",
\ "prev": "N",
\ "quit": "gq",
\ }
let g:ctrlsf_extra_backend_args = {
\ 'rg': '--hidden --glob "!.git/*"'
\ }
let g:ctrlsf_populate_qflist = 1
nnoremap <leader>f :CtrlSF<space>
nnoremap <leader><leader>f :CtrlSF<space><C-R><C-W>
vmap <leader><leader>f <Plug>CtrlSFVwordPath
command! CSFT execute ":CtrlSFToggle"
- file:
Theres nothing in specific on any file, its random, I can make the same search twice, and first it breaks, and then it works fine... I noticed it usually happen on async searches, with lots of results being displayed
The error messages implies it's more likely a problem related to nvim. Sorry for that I'm not using nvim so I can't figure out the root cause, but updating your nvim to latest or downgrading to a specific stable version may help.
Had the same issue, turns out I was using an older version of Neovim. For whatever reason, the package in Ubuntu hasn't been updated in some time.
Pull and build from source, or try the AppImage, and give that a shot!