0
0
mirror of https://github.com/vim/vim.git synced 2025-09-25 03:54:15 -04:00

patch 8.0.1193: crash when wiping out a buffer after using getbufinfo()

Problem:    Crash when wiping out a buffer after using getbufinfo().
            (Yegappan Lakshmanan)
Solution:   Remove b:changedtick from the buffer variables.
This commit is contained in:
Bram Moolenaar
2017-10-14 21:15:58 +02:00
parent ac8069bb63
commit b2c8750c4e
3 changed files with 9 additions and 1 deletions

View File

@@ -837,6 +837,8 @@ free_buffer(buf_T *buf)
++buf_free_count; ++buf_free_count;
free_buffer_stuff(buf, TRUE); free_buffer_stuff(buf, TRUE);
#ifdef FEAT_EVAL #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); unref_var_dict(buf->b_vars);
#endif #endif
#ifdef FEAT_LUA #ifdef FEAT_LUA

View File

@@ -769,10 +769,14 @@ func Test_BufLeave_Wipe()
bwipe! bwipe!
call assert_equal(1, line('$')) call assert_equal(1, line('$'))
call assert_equal('', bufname('%')) 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('Xxx1')
call delete('Xxx2') call delete('Xxx2')
%bwipe %bwipe
au! BufLeave au! BufLeave
" check that bufinfo doesn't contain a pointer to freed memory
call test_garbagecollect_now()
endfunc endfunc

View File

@@ -761,6 +761,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
1193,
/**/ /**/
1192, 1192,
/**/ /**/