aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/main.c
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2024-10-21 07:22:42 +0800
committerGitHub <noreply@github.com>2024-10-21 07:22:42 +0800
commit8c2d45be77299d6eb70165697bc5c29898cdb25e (patch)
tree085ebb2cf00316951f5ac0521d4087b713cf77dd /src/nvim/main.c
parent0083e03d6fa7586d0d6360b40b52b0cab0d2e7ba (diff)
downloadrneovim-8c2d45be77299d6eb70165697bc5c29898cdb25e.tar.gz
rneovim-8c2d45be77299d6eb70165697bc5c29898cdb25e.tar.bz2
rneovim-8c2d45be77299d6eb70165697bc5c29898cdb25e.zip
fix(exit): close memfiles after processing events (#30872)
Problem: When exiting, processed events may still use memfiles after they are closed. Solution: Close memfiles after processing events.
Diffstat (limited to 'src/nvim/main.c')
-rw-r--r--src/nvim/main.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/nvim/main.c b/src/nvim/main.c
index b54b2a531a..436c3ccc7a 100644
--- a/src/nvim/main.c
+++ b/src/nvim/main.c
@@ -678,12 +678,14 @@ void os_exit(int r)
} else {
ui_flush();
ui_call_stop();
- ml_close_all(true); // remove all memfiles
}
if (!event_teardown() && r == 0) {
r = 1; // Exit with error if main_loop did not teardown gracefully.
}
+ if (!ui_client_channel_id) {
+ ml_close_all(true); // remove all memfiles
+ }
if (used_stdin) {
stream_set_blocking(STDIN_FILENO, true); // normalize stream (#2598)
}