diff src/terminal.c @ 22230:0bbc8be90207 v8.2.1664

patch 8.2.1664: memory leak when using :mkview with a terminal buffer Commit: https://github.com/vim/vim/commit/c2c820563441499892359da949db3c8f7f16d109 Author: Bram Moolenaar <Bram@vim.org> Date: Fri Sep 11 22:10:22 2020 +0200 patch 8.2.1664: memory leak when using :mkview with a terminal buffer Problem: Memory leak when using :mkview with a terminal buffer. Solution: Don't use a hastab for :mkview. (Rob Pilling, closes https://github.com/vim/vim/issues/6935)
author Bram Moolenaar <Bram@vim.org>
date Fri, 11 Sep 2020 22:15:03 +0200
parents 4ed106deb772
children 5e287462487e
line wrap: on
line diff
--- a/src/terminal.c
+++ b/src/terminal.c
@@ -940,7 +940,7 @@ term_write_session(FILE *fd, win_T *wp, 
     const int	bufnr = wp->w_buffer->b_fnum;
     term_T	*term = wp->w_buffer->b_term;
 
-    if (wp->w_buffer->b_nwindows > 1)
+    if (terminal_bufs != NULL && wp->w_buffer->b_nwindows > 1)
     {
 	// There are multiple views into this terminal buffer. We don't want to
 	// create the terminal multiple times. If it's the first time, create,
@@ -978,7 +978,7 @@ term_write_session(FILE *fd, win_T *wp, 
     if (fprintf(fd, "let s:term_buf_%d = bufnr()", bufnr) < 0)
 	return FAIL;
 
-    if (wp->w_buffer->b_nwindows > 1)
+    if (terminal_bufs != NULL && wp->w_buffer->b_nwindows > 1)
     {
 	char *hash_key = alloc(NUMBUFLEN);