]> granicus.if.org Git - vim/commitdiff
patch 8.0.0483: illegal memory access when using :all v8.0.0483
authorBram Moolenaar <Bram@vim.org>
Sat, 18 Mar 2017 22:11:04 +0000 (23:11 +0100)
committerBram Moolenaar <Bram@vim.org>
Sat, 18 Mar 2017 22:11:04 +0000 (23:11 +0100)
Problem:    Illegal memory access when using :all. (Dominique Pelle)
Solution:   Adjust the cursor position right after setting "curwin".

src/testdir/test_window_cmd.vim
src/version.c
src/window.c

index 569a78a0ed748de58912ec0b8c54932885313e1a..6c9ddc289a530e780d0a006c70268e100d60fa3c 100644 (file)
@@ -67,4 +67,16 @@ function Test_window_cmd_wincmd_gf()
   augroup! test_window_cmd_wincmd_gf
 endfunc
 
+func Test_next_split_all()
+  " This was causing an illegal memory access.
+  n x
+  norm axxx
+  split
+  split
+  s/x
+  s/x
+  all
+  bwipe!
+endfunc
+
 " vim: shiftwidth=2 sts=2 expandtab
index 828450d17189b0386e23b415a76a3e387c2ef947..bb4cadcd9a8086428b078634405ff1f638e0b0ac 100644 (file)
@@ -764,6 +764,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    483,
 /**/
     482,
 /**/
index 06f97de2723ece06d2159752ba3f8e29a0de6de8..d0dff69e0a194d2634b23ef117313cea01383c78 100644 (file)
@@ -2450,6 +2450,10 @@ win_close(win_T *win, int free_buf)
 #endif
        curbuf = curwin->w_buffer;
        close_curwin = TRUE;
+
+       /* The cursor position may be invalid if the buffer changed after last
+        * using the window. */
+       check_cursor();
     }
     if (p_ea && (*p_ead == 'b' || *p_ead == dir))
        win_equal(curwin, TRUE, dir);