mirror of
https://github.com/neovim/neovim.git
synced 2026-08-28 18:11:47 +00:00
vim-patch:8.2.5163: crash when deleting buffers in diff mode
Problem: Crash when deleting buffers in diff mode.
Solution: Recompute diffs later. Skip window without a valid buffer.
cd38bb4d83
This commit is contained in:
@@ -115,7 +115,10 @@ void diff_buf_delete(buf_T *buf)
|
||||
tp->tp_diff_invalid = true;
|
||||
|
||||
if (tp == curtab) {
|
||||
diff_redraw(true);
|
||||
// don't redraw right away, more might change or buffer state
|
||||
// is invalid right now
|
||||
need_diff_redraw = true;
|
||||
redraw_later(curwin, VALID);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -648,7 +651,8 @@ void diff_redraw(bool dofold)
|
||||
|
||||
need_diff_redraw = false;
|
||||
FOR_ALL_WINDOWS_IN_TAB(wp, curtab) {
|
||||
if (!wp->w_p_diff) {
|
||||
// when closing windows or wiping buffers skip invalid window
|
||||
if (!wp->w_p_diff || !buf_valid(wp->w_buffer)) {
|
||||
continue;
|
||||
}
|
||||
redraw_later(wp, SOME_VALID);
|
||||
|
||||
@@ -1446,5 +1446,17 @@ func Test_diff_scroll()
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user