diff options
author | Bram Moolenaar <Bram@vim.org> | 2022-06-26 14:04:07 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2022-06-26 14:04:07 +0100 |
commit | cd38bb4d83c942c4bad596835c6766cbf32e5195 (patch) | |
tree | c6244fcf54ffc400bcfb6be4337e280ff53cba6f /src/diff.c | |
parent | 0971c7a4e537ea120a6bb2195960be8d0815e97b (diff) |
patch 8.2.5163: crash when deleting buffers in diff modev8.2.5163
Problem: Crash when deleting buffers in diff mode.
Solution: Recompute diffs later. Skip window without a valid buffer.
Diffstat (limited to 'src/diff.c')
-rw-r--r-- | src/diff.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/diff.c b/src/diff.c index df3dea0a17..eddf331656 100644 --- a/src/diff.c +++ b/src/diff.c @@ -119,7 +119,12 @@ diff_buf_delete(buf_T *buf) tp->tp_diffbuf[i] = NULL; 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(VALID); + } } } } @@ -670,7 +675,8 @@ diff_redraw( need_diff_redraw = FALSE; FOR_ALL_WINDOWS(wp) - if (wp->w_p_diff) + // 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) |