diff src/terminal.c @ 11804:5630978ae089 v8.0.0784

patch 8.0.0784: job of terminal may be garbage collected commit https://github.com/vim/vim/commit/a2c45a17c174d815fd1d160f92ec6c277201e111 Author: Bram Moolenaar <Bram@vim.org> Date: Thu Jul 27 22:14:59 2017 +0200 patch 8.0.0784: job of terminal may be garbage collected Problem: Job of terminal may be garbage collected. Solution: Set copyID on job in terminal. (Ozaki Kiichi)
author Christian Brabandt <cb@256bit.org>
date Thu, 27 Jul 2017 22:30:04 +0200
parents b1fd49b4eea7
children d3d0db111d17
line wrap: on
line diff
--- a/src/terminal.c
+++ b/src/terminal.c
@@ -1371,6 +1371,26 @@ term_report_winsize(term_T *term, int ro
     }
 }
 
+/*
+ * Mark references in jobs of terminals.
+ */
+    int
+set_ref_in_term(int copyID)
+{
+    int		abort = FALSE;
+    term_T	*term;
+    typval_T	tv;
+
+    for (term = first_term; term != NULL; term = term->tl_next)
+	if (term->tl_job != NULL)
+	{
+	    tv.v_type = VAR_JOB;
+	    tv.vval.v_job = term->tl_job;
+	    abort = abort || set_ref_in_item(&tv, copyID, NULL, NULL);
+	}
+    return abort;
+}
+
 # endif
 
 #endif /* FEAT_TERMINAL */