aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-06-12 19:06:30 +0800
committerzeertzjq <zeertzjq@outlook.com>2022-06-13 16:05:02 +0800
commit254454d0c5a92acaa2c7d199236c216a9de8b6ee (patch)
tree9068ba97d9ab557f4fcc1578a53c60ba64f2cf00
parentdd8b6094c03362cc60d627ce709a4a0f9825b86a (diff)
downloadrneovim-254454d0c5a92acaa2c7d199236c216a9de8b6ee.tar.gz
rneovim-254454d0c5a92acaa2c7d199236c216a9de8b6ee.tar.bz2
rneovim-254454d0c5a92acaa2c7d199236c216a9de8b6ee.zip
vim-patch:8.2.5079: DirChanged autocommand may use freed memory
Problem: DirChanged autocommand may use freed memory. (Shane-XB Qian) Solution: Free the memory later. (closes vim/vim#10555) https://github.com/vim/vim/commit/d8c9d32c8932e93008bfd4e8828ed42f4e9f8315 Code change is N/A as Nvim gets the full current directory again before applying the autocommand, so this just ports the tests.
-rw-r--r--src/nvim/testdir/test_autocmd.vim7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/nvim/testdir/test_autocmd.vim b/src/nvim/testdir/test_autocmd.vim
index 13be82a71d..9d4568b196 100644
--- a/src/nvim/testdir/test_autocmd.vim
+++ b/src/nvim/testdir/test_autocmd.vim
@@ -1981,6 +1981,13 @@ function Test_dirchanged_global()
call assert_equal(expected, s:li)
exe 'lcd ' .. fnameescape(s:dir_bar)
call assert_equal(expected, s:li)
+
+ exe 'cd ' .. s:dir_foo
+ exe 'cd ' .. s:dir_bar
+ autocmd! test_dirchanged DirChanged global let g:result = expand("<afile>")
+ cd -
+ call assert_equal(s:dir_foo, g:result)
+
call s:After_test_dirchanged()
endfunc