aboutsummaryrefslogtreecommitdiff
path: root/src/misc1.c
diff options
context:
space:
mode:
authorDane Summers <dsummersl@yahoo.com>2014-04-30 08:20:27 -0400
committerJustin M. Keyes <justinkz@gmail.com>2014-05-06 13:53:22 -0400
commit85459327ba76d674572ad96dc459c97e4a71e88d (patch)
treeb6cb1102437000ea14ee8a8b041f62018bcf4256 /src/misc1.c
parentd910ef2099f476ab2564d7c9ba2a33dc797b6385 (diff)
downloadrneovim-85459327ba76d674572ad96dc459c97e4a71e88d.tar.gz
rneovim-85459327ba76d674572ad96dc459c97e4a71e88d.tar.bz2
rneovim-85459327ba76d674572ad96dc459c97e4a71e88d.zip
Prevent preserve_exit() from executing more than once.
https://github.com/neovim/neovim/issues/563
Diffstat (limited to 'src/misc1.c')
-rw-r--r--src/misc1.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/misc1.c b/src/misc1.c
index 3f8a1b934a..dbe4064b47 100644
--- a/src/misc1.c
+++ b/src/misc1.c
@@ -3373,12 +3373,15 @@ void preserve_exit(void)
{
buf_T *buf;
- prepare_to_exit();
+ // Prevent repeated calls into this method.
+ if (really_exiting) {
+ exit(2);
+ }
- /* Setting this will prevent free() calls. That avoids calling free()
- * recursively when free() was invoked with a bad pointer. */
really_exiting = TRUE;
+ prepare_to_exit();
+
out_str(IObuff);
screen_start(); /* don't know where cursor is now */
out_flush();