patch 7.4.2006
Problem: Crash when using tabnext in BufUnload autocmd. (Norio Takagi)
Solution: First check that the current buffer is the right one. (Hirohito
Higashi)
diff --git a/src/testdir/test_autocmd.vim b/src/testdir/test_autocmd.vim
index 1dceb70..187d8d2 100644
--- a/src/testdir/test_autocmd.vim
+++ b/src/testdir/test_autocmd.vim
@@ -60,3 +60,21 @@
augroup! test_bufunload_group
endfunc
+
+" SEGV occurs in older versions. (At least 7.4.2005 or older)
+function Test_autocmd_bufunload_with_tabnext()
+ tabedit
+ tabfirst
+
+ augroup test_autocmd_bufunload_with_tabnext_group
+ autocmd!
+ autocmd BufUnload <buffer> tabnext
+ augroup END
+
+ quit
+ call assert_equal(2, tabpagenr('$'))
+
+ augroup! test_autocmd_bufunload_with_tabnext_group
+ tablast
+ quit
+endfunc