Skip to content

Commit 20d6ca2

Browse files
committed
Merge remote-tracking branch 'vim/master'
2 parents 5d7520f + 7618e00 commit 20d6ca2

File tree

5 files changed

+42
-2
lines changed

5 files changed

+42
-2
lines changed

src/quickfix.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1617,7 +1617,7 @@ static char_u *qf_last_bufname = NULL;
16171617
static bufref_T qf_last_bufref = {NULL, 0};
16181618

16191619
/*
1620-
* Get buffer number for file "directory.fname".
1620+
* Get buffer number for file "directory/fname".
16211621
* Also sets the b_has_qf_entry flag.
16221622
*/
16231623
static int
@@ -2711,7 +2711,9 @@ qf_free(qf_info_T *qi, int idx)
27112711
qi->qf_lists[idx].qf_index = 0;
27122712

27132713
qf_clean_dir_stack(&qi->qf_dir_stack);
2714+
qi->qf_directory = NULL;
27142715
qf_clean_dir_stack(&qi->qf_file_stack);
2716+
qi->qf_currfile = NULL;
27152717
}
27162718

27172719
/*

src/testdir/test_quickfix.vim

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1669,3 +1669,25 @@ func Test_caddexpr_wrong()
16691669
call assert_fails('caddexpr ""', 'E376:')
16701670
let &efm = save_efm
16711671
endfunc
1672+
1673+
func Test_dirstack_cleanup()
1674+
" This used to cause a memory access in freed memory.
1675+
let save_efm = &efm
1676+
lexpr '0'
1677+
lopen
1678+
fun X(c)
1679+
let save_efm=&efm
1680+
set efm=%D%f
1681+
if a:c == 'c'
1682+
caddexpr '::'
1683+
else
1684+
laddexpr ':0:0'
1685+
endif
1686+
let &efm=save_efm
1687+
endfun
1688+
call X('c')
1689+
call X('l')
1690+
call setqflist([], 'r')
1691+
caddbuffer
1692+
let &efm = save_efm
1693+
endfunc

src/testdir/test_window_id.vim

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,3 +92,12 @@ func Test_win_getid()
9292

9393
only!
9494
endfunc
95+
96+
func Test_win_getid_curtab()
97+
tabedit X
98+
tabfirst
99+
copen
100+
only
101+
call assert_equal(win_getid(1), win_getid(1, 1))
102+
tabclose!
103+
endfunc

src/version.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -779,6 +779,10 @@ static char *(features[]) =
779779

780780
static int included_patches[] =
781781
{ /* Add new patch number below this line */
782+
/**/
783+
84,
784+
/**/
785+
83,
782786
/**/
783787
82,
784788
/**/

src/window.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7146,7 +7146,10 @@ win_getid(typval_T *argvars)
71467146
break;
71477147
if (tp == NULL)
71487148
return -1;
7149-
wp = tp->tp_firstwin;
7149+
if (tp == curtab)
7150+
wp = firstwin;
7151+
else
7152+
wp = tp->tp_firstwin;
71507153
}
71517154
for ( ; wp != NULL; wp = wp->w_next)
71527155
if (--winnr == 0)

0 commit comments

Comments
 (0)