diff options
author | Gregory Anders <greg@gpanders.com> | 2021-08-27 20:17:11 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-27 19:17:11 -0700 |
commit | 8af13ed946aa06636c633327c6549993e2e50116 (patch) | |
tree | d85cad5a37230adfc558838e2a5c415d76638767 | |
parent | ff7f7dd26b45164a41dbc36799cb7b08ebb9f66b (diff) | |
download | rneovim-8af13ed946aa06636c633327c6549993e2e50116.tar.gz rneovim-8af13ed946aa06636c633327c6549993e2e50116.tar.bz2 rneovim-8af13ed946aa06636c633327c6549993e2e50116.zip |
fix(process_wait): drain proc.events directly #15501
After a process's refcnt is decremented to zero, it enqueues a
`process_close_event` on its own event queue. In `process_wait`, this
event should be processed immediately so that any process close
callbacks are executed before `process_wait` returns.
Update `process_wait` to always process the process's event queue after
the process is freed, rather than the event queue passed in as an
argument.
-rw-r--r-- | src/nvim/event/process.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/nvim/event/process.c b/src/nvim/event/process.c index b93d6cc0ab..a2aafc94c8 100644 --- a/src/nvim/event/process.c +++ b/src/nvim/event/process.c @@ -200,9 +200,9 @@ int process_wait(Process *proc, int ms, MultiQueue *events) if (proc->refcount == 1) { // Job exited, free its resources. decref(proc); - if (events) { + if (proc->events) { // the decref call created an exit event, process it now - multiqueue_process_events(events); + multiqueue_process_events(proc->events); } } else { proc->refcount--; |