To: vim_dev@googlegroups.com Subject: Patch 8.0.0784 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.0.0784 Problem: Job of terminal may be garbage collected. Solution: Set copyID on job in terminal. (Ozaki Kiichi) Files: src/terminal.c, src/eval.c, src/proto/terminal.pro *** ../vim-8.0.0783/src/terminal.c 2017-07-27 22:07:31.649103588 +0200 --- src/terminal.c 2017-07-27 22:13:20.262639562 +0200 *************** *** 1371,1376 **** --- 1371,1396 ---- } } + /* + * 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 */ *** ../vim-8.0.0783/src/eval.c 2017-04-30 20:12:53.374810691 +0200 --- src/eval.c 2017-07-27 22:12:00.071206139 +0200 *************** *** 5329,5334 **** --- 5329,5338 ---- abort = abort || set_ref_in_quickfix(copyID); #endif + #ifdef FEAT_TERMINAL + abort = abort || set_ref_in_term(copyID); + #endif + if (!abort) { /* *** ../vim-8.0.0783/src/proto/terminal.pro 2017-07-24 21:44:38.768901080 +0200 --- src/proto/terminal.pro 2017-07-27 22:12:52.686834379 +0200 *************** *** 6,9 **** --- 6,10 ---- 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 : */ *** ../vim-8.0.0783/src/version.c 2017-07-27 22:07:31.649103588 +0200 --- src/version.c 2017-07-27 22:11:13.039538493 +0200 *************** *** 771,772 **** --- 771,774 ---- { /* Add new patch number below this line */ + /**/ + 784, /**/ -- There is a fine line between courage and foolishness. Unfortunately, it's not a fence. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///