diff options
Diffstat (limited to 'src/nvim/window.c')
-rw-r--r-- | src/nvim/window.c | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/src/nvim/window.c b/src/nvim/window.c index 755ecb0ef1..3499b14688 100644 --- a/src/nvim/window.c +++ b/src/nvim/window.c @@ -3576,7 +3576,6 @@ win_free ( ) { int i; - buf_T *buf; wininfo_T *wip; handle_unregister_window(wp); @@ -3589,13 +3588,6 @@ win_free ( * gui_mch_destroy_scrollbar() may trigger a FocusGained event. */ block_autocmds(); - - - - - - - clear_winopt(&wp->w_onebuf_opt); clear_winopt(&wp->w_allbuf_opt); @@ -3614,10 +3606,11 @@ win_free ( /* Remove the window from the b_wininfo lists, it may happen that the * freed memory is re-used for another window. */ - for (buf = firstbuf; buf != NULL; buf = buf->b_next) + FOR_ALL_BUFFERS(buf) { for (wip = buf->b_wininfo; wip != NULL; wip = wip->wi_next) if (wip->wi_win == wp) wip->wi_win = NULL; + } clear_matches(wp); @@ -3737,8 +3730,11 @@ void win_alloc_lines(win_T *wp) */ void win_free_lsize(win_T *wp) { - free(wp->w_lines); - wp->w_lines = NULL; + // TODO: why would wp be NULL here? + if (wp != NULL) { + free(wp->w_lines); + wp->w_lines = NULL; + } } /* |