Patch 8.2.5163
Problem: Crash when deleting buffers in diff mode.
Solution: Recompute diffs later. Skip window without a valid buffer.
Files: src/diff.c, src/testdir/test_diffmode.vim
*** ../vim-8.2.5162/src/diff.c 2022-04-15 13:53:30.044708701 +0100
--- src/diff.c 2022-06-26 14:03:47.388884703 +0100
***************
*** 119,125 ****
tp->tp_diffbuf[i] = NULL;
tp->tp_diff_invalid = TRUE;
if (tp == curtab)
! diff_redraw(TRUE);
}
}
}
--- 119,130 ----
tp->tp_diffbuf[i] = NULL;
tp->tp_diff_invalid = TRUE;
if (tp == curtab)
! {
! // don't redraw right away, more might change or buffer state
! // is invalid right now
! need_diff_redraw = TRUE;
! redraw_later(VALID);
! }
}
}
}
***************
*** 670,676 ****
need_diff_redraw = FALSE;
FOR_ALL_WINDOWS(wp)
! if (wp->w_p_diff)
{
redraw_win_later(wp, SOME_VALID);
if (wp != curwin)
--- 675,682 ----
need_diff_redraw = FALSE;
FOR_ALL_WINDOWS(wp)
! // when closing windows or wiping buffers skip invalid window
! if (wp->w_p_diff && buf_valid(wp->w_buffer))
{
redraw_win_later(wp, SOME_VALID);
if (wp != curwin)
*** ../vim-8.2.5162/src/testdir/test_diffmode.vim 2022-06-24 12:38:33.986247430 +0100
--- src/testdir/test_diffmode.vim 2022-06-26 14:02:00.421049498 +0100
***************
*** 1603,1607 ****
--- 1603,1619 ----
call delete('Xright')
endfunc
+ " This was trying to update diffs for a buffer being closed
+ func Test_diff_only()
+ silent! lfile
+ set diff
+ lopen
+ norm o
+ silent! norm o
+
+ set nodiff
+ %bwipe!
+ endfunc
+
" vim: shiftwidth=2 sts=2 expandtab
*** ../vim-8.2.5162/src/version.c 2022-06-26 12:58:56.146042644 +0100
--- src/version.c 2022-06-26 13:31:46.389800150 +0100
***************
*** 737,738 ****
--- 737,740 ----
{ /* Add new patch number below this line */
+ /**/
+ 5163,
/**/
--
Everybody wants to go to heaven, but nobody wants to die.
/// Bram Moolenaar -- Br...@Moolenaar.net --
http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features --
http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims --
http://ICCF-Holland.org ///