mirror of
https://github.com/vim/vim.git
synced 2025-09-25 03:54:15 -04:00
patch 8.1.0060: crash when autocommands delete the current buffer
Problem: Crash when autocommands delete the current buffer. (Dominique Pelle) Solution: Check that autocommands don't change the buffer.
This commit is contained in:
@@ -6272,8 +6272,16 @@ ex_cbuffer(exarg_T *eap)
|
|||||||
if (res >= 0)
|
if (res >= 0)
|
||||||
qf_list_changed(qi, qi->qf_curlist);
|
qf_list_changed(qi, qi->qf_curlist);
|
||||||
if (au_name != NULL)
|
if (au_name != NULL)
|
||||||
|
{
|
||||||
|
buf_T *curbuf_old = curbuf;
|
||||||
|
|
||||||
apply_autocmds(EVENT_QUICKFIXCMDPOST, au_name,
|
apply_autocmds(EVENT_QUICKFIXCMDPOST, au_name,
|
||||||
curbuf->b_fname, TRUE, curbuf);
|
curbuf->b_fname, TRUE, curbuf);
|
||||||
|
if (curbuf != curbuf_old)
|
||||||
|
// Autocommands changed buffer, don't jump now, "qi" may
|
||||||
|
// be invalid.
|
||||||
|
res = 0;
|
||||||
|
}
|
||||||
if (res > 0 && (eap->cmdidx == CMD_cbuffer ||
|
if (res > 0 && (eap->cmdidx == CMD_cbuffer ||
|
||||||
eap->cmdidx == CMD_lbuffer))
|
eap->cmdidx == CMD_lbuffer))
|
||||||
qf_jump(qi, 0, 0, eap->forceit); /* display first error */
|
qf_jump(qi, 0, 0, eap->forceit); /* display first error */
|
||||||
|
@@ -3350,3 +3350,15 @@ func Test_qftitle()
|
|||||||
call assert_equal('Errors', w:quickfix_title)
|
call assert_equal('Errors', w:quickfix_title)
|
||||||
cclose
|
cclose
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
func Test_lbuffer_with_bwipe()
|
||||||
|
new
|
||||||
|
new
|
||||||
|
augroup nasty
|
||||||
|
au * * bwipe
|
||||||
|
augroup END
|
||||||
|
lbuffer
|
||||||
|
augroup nasty
|
||||||
|
au!
|
||||||
|
augroup END
|
||||||
|
endfunc
|
||||||
|
@@ -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 */
|
||||||
|
/**/
|
||||||
|
60,
|
||||||
/**/
|
/**/
|
||||||
59,
|
59,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user