diff options
author | Bram Moolenaar <Bram@vim.org> | 2017-10-14 21:15:58 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2017-10-14 21:15:58 +0200 |
commit | b2c8750c4e95f64a8dff912af81e13318b3f6ed6 (patch) | |
tree | 55be4c79f21f17a5f97ecad64efefa47c808b41c | |
parent | ac8069bb63c5954c787fe93b7a9265de3c0c6853 (diff) | |
download | vim-git-b2c8750c4e95f64a8dff912af81e13318b3f6ed6.tar.gz |
patch 8.0.1193: crash when wiping out a buffer after using getbufinfo()v8.0.1193
Problem: Crash when wiping out a buffer after using getbufinfo().
(Yegappan Lakshmanan)
Solution: Remove b:changedtick from the buffer variables.
-rw-r--r-- | src/buffer.c | 2 | ||||
-rw-r--r-- | src/testdir/test_autocmd.vim | 6 | ||||
-rw-r--r-- | src/version.c | 2 |
3 files changed, 9 insertions, 1 deletions
diff --git a/src/buffer.c b/src/buffer.c index 300582bd0..22effbb81 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -837,6 +837,8 @@ free_buffer(buf_T *buf) ++buf_free_count; free_buffer_stuff(buf, TRUE); #ifdef FEAT_EVAL + /* b:changedtick uses an item in buf_T, remove it now */ + dictitem_remove(buf->b_vars, (dictitem_T *)&buf->b_ct_di); unref_var_dict(buf->b_vars); #endif #ifdef FEAT_LUA diff --git a/src/testdir/test_autocmd.vim b/src/testdir/test_autocmd.vim index d0564f386..49388a1a7 100644 --- a/src/testdir/test_autocmd.vim +++ b/src/testdir/test_autocmd.vim @@ -769,10 +769,14 @@ func Test_BufLeave_Wipe() bwipe! call assert_equal(1, line('$')) call assert_equal('', bufname('%')) - call assert_equal(1, len(getbufinfo())) + let g:bufinfo = getbufinfo() + call assert_equal(1, len(g:bufinfo)) call delete('Xxx1') call delete('Xxx2') %bwipe au! BufLeave + + " check that bufinfo doesn't contain a pointer to freed memory + call test_garbagecollect_now() endfunc diff --git a/src/version.c b/src/version.c index d16baeb27..fa4d4e76a 100644 --- a/src/version.c +++ b/src/version.c @@ -762,6 +762,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 1193, +/**/ 1192, /**/ 1191, |