Skip to content

Commit f79225e

Browse files
committed
patch 8.0.0483: illegal memory access when using :all
Problem: Illegal memory access when using :all. (Dominique Pelle) Solution: Adjust the cursor position right after setting "curwin".
1 parent 2c90d51 commit f79225e

File tree

3 files changed

+18
-0
lines changed

3 files changed

+18
-0
lines changed

src/testdir/test_window_cmd.vim

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,4 +67,16 @@ function Test_window_cmd_wincmd_gf()
6767
augroup! test_window_cmd_wincmd_gf
6868
endfunc
6969

70+
func Test_next_split_all()
71+
" This was causing an illegal memory access.
72+
n x
73+
norm axxx
74+
split
75+
split
76+
s/x
77+
s/x
78+
all
79+
bwipe!
80+
endfunc
81+
7082
" vim: shiftwidth=2 sts=2 expandtab

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -764,6 +764,8 @@ static char *(features[]) =
764764

765765
static int included_patches[] =
766766
{ /* Add new patch number below this line */
767+
/**/
768+
483,
767769
/**/
768770
482,
769771
/**/

src/window.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2450,6 +2450,10 @@ win_close(win_T *win, int free_buf)
24502450
#endif
24512451
curbuf = curwin->w_buffer;
24522452
close_curwin = TRUE;
2453+
2454+
/* The cursor position may be invalid if the buffer changed after last
2455+
* using the window. */
2456+
check_cursor();
24532457
}
24542458
if (p_ea && (*p_ead == 'b' || *p_ead == dir))
24552459
win_equal(curwin, TRUE, dir);

0 commit comments

Comments
 (0)