Mercurial > vim
comparison src/terminal.c @ 11802:b1fd49b4eea7 v8.0.0783
patch 8.0.0783: job of terminal may be freed too early
commit https://github.com/vim/vim/commit/0e83f02d80acacee55c5de3bbbee52625d368375
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Jul 27 22:07:35 2017 +0200
patch 8.0.0783: job of terminal may be freed too early
Problem: Job of terminal may be freed too early.
Solution: Increment job refcount. (Yasuhiro Matsumoto)
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Thu, 27 Jul 2017 22:15:04 +0200 |
parents | 4d545cd33f0a |
children | 5630978ae089 |
comparison
equal
deleted
inserted
replaced
11801:ad0f51ab1159 | 11802:b1fd49b4eea7 |
---|---|
1245 job->jv_channel = channel; | 1245 job->jv_channel = channel; |
1246 job->jv_proc_info.hProcess = child_process_handle; | 1246 job->jv_proc_info.hProcess = child_process_handle; |
1247 job->jv_proc_info.dwProcessId = GetProcessId(child_process_handle); | 1247 job->jv_proc_info.dwProcessId = GetProcessId(child_process_handle); |
1248 job->jv_job_object = jo; | 1248 job->jv_job_object = jo; |
1249 job->jv_status = JOB_STARTED; | 1249 job->jv_status = JOB_STARTED; |
1250 ++job->jv_refcount; | |
1250 term->tl_job = job; | 1251 term->tl_job = job; |
1251 | 1252 |
1252 return OK; | 1253 return OK; |
1253 | 1254 |
1254 failed: | 1255 failed: |
1327 | 1328 |
1328 argvars[0].v_type = VAR_STRING; | 1329 argvars[0].v_type = VAR_STRING; |
1329 argvars[0].vval.v_string = cmd; | 1330 argvars[0].vval.v_string = cmd; |
1330 setup_job_options(&opt, rows, cols); | 1331 setup_job_options(&opt, rows, cols); |
1331 term->tl_job = job_start(argvars, &opt); | 1332 term->tl_job = job_start(argvars, &opt); |
1333 if (term->tl_job != NULL) | |
1334 ++term->tl_job->jv_refcount; | |
1332 | 1335 |
1333 return term->tl_job != NULL | 1336 return term->tl_job != NULL |
1334 && term->tl_job->jv_channel != NULL | 1337 && term->tl_job->jv_channel != NULL |
1335 && term->tl_job->jv_status != JOB_FAILED ? OK : FAIL; | 1338 && term->tl_job->jv_status != JOB_FAILED ? OK : FAIL; |
1336 } | 1339 } |