patch 7.4.2309
Problem:    Crash when doing tabnext in a BufUnload autocmd. (Dominique Pelle)
Solution:   When detecting that the tab page changed, don't just abort but
            delete the window where w_buffer is NULL.
diff --git a/src/testdir/test_tabpage.vim b/src/testdir/test_tabpage.vim
index f1c41e9..7bdea0b 100644
--- a/src/testdir/test_tabpage.vim
+++ b/src/testdir/test_tabpage.vim
@@ -218,4 +218,18 @@
   bw!
 endfunction
 
+func Test_tabnext_on_buf_unload()
+  " This once caused a crash
+  new
+  tabedit
+  tabfirst
+  au BufUnload <buffer> tabnext
+  q
+
+  while tabpagenr('$') > 1
+    quit
+  endwhile
+endfunc
+
+
 " vim: shiftwidth=2 sts=2 expandtab