Skip to content

Commit a2c45a1

Browse files
committed
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)
1 parent 0e83f02 commit a2c45a1

4 files changed

Lines changed: 27 additions & 0 deletions

File tree

src/eval.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5329,6 +5329,10 @@ garbage_collect(int testing)
53295329
abort = abort || set_ref_in_quickfix(copyID);
53305330
#endif
53315331

5332+
#ifdef FEAT_TERMINAL
5333+
abort = abort || set_ref_in_term(copyID);
5334+
#endif
5335+
53325336
if (!abort)
53335337
{
53345338
/*

src/proto/terminal.pro

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,5 @@ void terminal_loop(void);
66
void term_job_ended(job_T *job);
77
void term_update_window(win_T *wp);
88
char_u *term_get_status_text(term_T *term);
9+
int set_ref_in_term(int copyID);
910
/* vim: set ft=c : */

src/terminal.c

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1371,6 +1371,26 @@ term_report_winsize(term_T *term, int rows, int cols)
13711371
}
13721372
}
13731373

1374+
/*
1375+
* Mark references in jobs of terminals.
1376+
*/
1377+
int
1378+
set_ref_in_term(int copyID)
1379+
{
1380+
int abort = FALSE;
1381+
term_T *term;
1382+
typval_T tv;
1383+
1384+
for (term = first_term; term != NULL; term = term->tl_next)
1385+
if (term->tl_job != NULL)
1386+
{
1387+
tv.v_type = VAR_JOB;
1388+
tv.vval.v_job = term->tl_job;
1389+
abort = abort || set_ref_in_item(&tv, copyID, NULL, NULL);
1390+
}
1391+
return abort;
1392+
}
1393+
13741394
# endif
13751395

13761396
#endif /* FEAT_TERMINAL */

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -769,6 +769,8 @@ static char *(features[]) =
769769

770770
static int included_patches[] =
771771
{ /* Add new patch number below this line */
772+
/**/
773+
784,
772774
/**/
773775
783,
774776
/**/

0 commit comments

Comments
 (0)