]> granicus.if.org Git - vim/commitdiff
patch 8.0.0784: job of terminal may be garbage collected v8.0.0784
authorBram Moolenaar <Bram@vim.org>
Thu, 27 Jul 2017 20:14:59 +0000 (22:14 +0200)
committerBram Moolenaar <Bram@vim.org>
Thu, 27 Jul 2017 20:14:59 +0000 (22:14 +0200)
Problem:    Job of terminal may be garbage collected.
Solution:   Set copyID on job in terminal. (Ozaki Kiichi)

src/eval.c
src/proto/terminal.pro
src/terminal.c
src/version.c

index 401171c9bd87f74a57580e271837d8081da58b85..4cb32893f10075fc99b1cc0eb261a563a4b8935f 100644 (file)
@@ -5329,6 +5329,10 @@ garbage_collect(int testing)
     abort = abort || set_ref_in_quickfix(copyID);
 #endif
 
+#ifdef FEAT_TERMINAL
+    abort = abort || set_ref_in_term(copyID);
+#endif
+
     if (!abort)
     {
        /*
index d7d153850ce38c757498587dfab6c309068fac02..ac0beb51d9084574936d70c1e410bedab66eab74 100644 (file)
@@ -6,4 +6,5 @@ void terminal_loop(void);
 void term_job_ended(job_T *job);
 void term_update_window(win_T *wp);
 char_u *term_get_status_text(term_T *term);
+int set_ref_in_term(int copyID);
 /* vim: set ft=c : */
index 6d8679d3935d02a0af82067a166fafae835d21a8..c4e1a520813faa2c07bcaf6e982fa0e8979fc120 100644 (file)
@@ -1371,6 +1371,26 @@ term_report_winsize(term_T *term, int rows, int cols)
     }
 }
 
+/*
+ * 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 */
index 1b13fd337857004e94c0a3c4bd7f77452d2a7d2b..43ea98a80ad9e42472648aee3501e921a0a51d04 100644 (file)
@@ -769,6 +769,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    784,
 /**/
     783,
 /**/