mirror of
https://github.com/neovim/neovim.git
synced 2024-12-29 14:41:06 -07:00
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.
This commit is contained in:
parent
ff7f7dd26b
commit
8af13ed946
@ -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--;
|
||||
|
Loading…
Reference in New Issue
Block a user