Mercurial > vim
comparison src/channel.c @ 9079:2cd83c854073 v7.4.1824
commit https://github.com/vim/vim/commit/36e0f7da9bc4a6ee8a7b17df503542a339e034c8
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun May 8 13:21:12 2016 +0200
patch 7.4.1824
Problem: When a job is no longer referenced and does not have an exit
callback the process may hang around in defunc state. (Nicola)
Solution: Call job_status() if the job is running and won't get freed
because it might still be useful.
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sun, 08 May 2016 13:30:07 +0200 |
parents | a86103d4b356 |
children | b2b915c1d311 |
comparison
equal
deleted
inserted
replaced
9078:ce97eee5a03f | 9079:2cd83c854073 |
---|---|
4142 { | 4142 { |
4143 /* Free the channel and ordinary items it contains, but don't | 4143 /* Free the channel and ordinary items it contains, but don't |
4144 * recurse into Lists, Dictionaries etc. */ | 4144 * recurse into Lists, Dictionaries etc. */ |
4145 job_free_contents(job); | 4145 job_free_contents(job); |
4146 did_free = TRUE; | 4146 did_free = TRUE; |
4147 } | 4147 } |
4148 return did_free; | 4148 return did_free; |
4149 } | 4149 } |
4150 | 4150 |
4151 void | 4151 void |
4152 free_unused_jobs(int copyID, int mask) | 4152 free_unused_jobs(int copyID, int mask) |
4232 if (job->jv_status == JOB_STARTED && job->jv_stoponexit != NULL) | 4232 if (job->jv_status == JOB_STARTED && job->jv_stoponexit != NULL) |
4233 mch_stop_job(job, job->jv_stoponexit); | 4233 mch_stop_job(job, job->jv_stoponexit); |
4234 } | 4234 } |
4235 | 4235 |
4236 /* | 4236 /* |
4237 * Called once in a while: check if any jobs with an "exit_cb" have ended. | 4237 * Called once in a while: check if any jobs that seem useful have ended. |
4238 */ | 4238 */ |
4239 void | 4239 void |
4240 job_check_ended(void) | 4240 job_check_ended(void) |
4241 { | 4241 { |
4242 static time_t last_check = 0; | 4242 static time_t last_check = 0; |
4250 { | 4250 { |
4251 last_check = now; | 4251 last_check = now; |
4252 for (job = first_job; job != NULL; job = next) | 4252 for (job = first_job; job != NULL; job = next) |
4253 { | 4253 { |
4254 next = job->jv_next; | 4254 next = job->jv_next; |
4255 if (job->jv_status == JOB_STARTED && job->jv_exit_cb != NULL) | 4255 if (job->jv_status == JOB_STARTED && job_still_useful(job)) |
4256 job_status(job); /* may free "job" */ | 4256 job_status(job); /* may free "job" */ |
4257 } | 4257 } |
4258 } | 4258 } |
4259 } | 4259 } |
4260 | 4260 |