diff options
-rw-r--r-- | src/nvim/msgpack_rpc/channel.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/nvim/msgpack_rpc/channel.c b/src/nvim/msgpack_rpc/channel.c index 1d24198455..edc4442785 100644 --- a/src/nvim/msgpack_rpc/channel.c +++ b/src/nvim/msgpack_rpc/channel.c @@ -484,6 +484,16 @@ void rpc_close(Channel *channel) } channel->rpc.closed = true; + + // Scheduled to avoid running UILeave autocommands in a libuv handler. + multiqueue_put(main_loop.fast_events, rpc_close_event, channel); +} + +static void rpc_close_event(void **argv) +{ + Channel *channel = (Channel *)argv[0]; + assert(channel); + channel_decref(channel); bool is_ui_client = ui_client_channel_id && channel->id == ui_client_channel_id; |