mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
vim-patch:7.4.1137
Problem: Illegal memory access when using :copen and :cclose.
Solution: Avoid that curbuf is invalid. (suggestion by Justin M. Keyes)
Add a test.
62ef797496
This commit is contained in:
parent
aa8b3b60ee
commit
aa17b4b4bc
@ -69,6 +69,10 @@ static char *features[] = {
|
|||||||
|
|
||||||
// clang-format off
|
// clang-format off
|
||||||
static int included_patches[] = {
|
static int included_patches[] = {
|
||||||
|
1137,
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
1081,
|
1081,
|
||||||
|
|
||||||
|
|
||||||
|
@ -1913,9 +1913,16 @@ int win_close(win_T *win, int free_buf)
|
|||||||
*/
|
*/
|
||||||
if (win->w_buffer != NULL) {
|
if (win->w_buffer != NULL) {
|
||||||
win->w_closing = true;
|
win->w_closing = true;
|
||||||
close_buffer(win, win->w_buffer, free_buf ? DOBUF_UNLOAD : 0, TRUE);
|
close_buffer(win, win->w_buffer, free_buf ? DOBUF_UNLOAD : 0, true);
|
||||||
if (win_valid(win))
|
if (win_valid(win)) {
|
||||||
win->w_closing = false;
|
win->w_closing = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Make sure curbuf is valid. It can become invalid if 'bufhidden' is
|
||||||
|
// "wipe".
|
||||||
|
if (!buf_valid(curbuf)) {
|
||||||
|
curbuf = firstbuf;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (only_one_window() && win_valid(win) && win->w_buffer == NULL
|
if (only_one_window() && win_valid(win) && win->w_buffer == NULL
|
||||||
|
18
test/functional/legacy/quickfix_spec.lua
Normal file
18
test/functional/legacy/quickfix_spec.lua
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
-- Test for the quickfix commands.
|
||||||
|
|
||||||
|
local helpers = require('test.functional.helpers')
|
||||||
|
local insert, source = helpers.insert, helpers.source
|
||||||
|
local clear, expect = helpers.clear, helpers.expect
|
||||||
|
|
||||||
|
describe('helpgrep', function()
|
||||||
|
before_each(clear)
|
||||||
|
|
||||||
|
it('works', function()
|
||||||
|
source([[
|
||||||
|
helpgrep quickfix
|
||||||
|
copen
|
||||||
|
" This wipes out the buffer, make sure that doesn't cause trouble.
|
||||||
|
cclose
|
||||||
|
]])
|
||||||
|
end)
|
||||||
|
end)
|
Loading…
Reference in New Issue
Block a user