summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2016-03-19 14:48:31 +0100
committerBram Moolenaar <Bram@vim.org>2016-03-19 14:48:31 +0100
commit6d8d849f5ac8a3a228c62fd29e8f40ae1b8381fc (patch)
tree3451095c6dc6f0873f2ef404f4337c5ffa0d1a0f
parent9f6154f26ef17b0a7efd2fcdd79cabfe510f28b4 (diff)
downloadvim-git-6d8d849f5ac8a3a228c62fd29e8f40ae1b8381fc.tar.gz
patch 7.4.1598v7.4.1598
Problem: When starting the GUI fails a swap file is left behind. (Joerg Plate) Solution: Preserve files before exiting. (closes #692)
-rw-r--r--src/gui.c6
-rw-r--r--src/main.c6
-rw-r--r--src/version.c2
3 files changed, 9 insertions, 5 deletions
diff --git a/src/gui.c b/src/gui.c
index f52d217aa..d5c0d3e22 100644
--- a/src/gui.c
+++ b/src/gui.c
@@ -105,7 +105,7 @@ gui_start(void)
/* If there is 'f' in 'guioptions' and specify -g argument,
* gui_mch_init_check() was not called yet. */
if (gui_mch_init_check() != OK)
- exit(1);
+ getout_preserve_modified(1);
#endif
gui_attempt_start();
}
@@ -272,7 +272,7 @@ gui_do_fork(void)
#ifdef FEAT_GUI_GTK
/* Call gtk_init_check() here after fork(). See gui_init_check(). */
if (gui_mch_init_check() != OK)
- exit(1);
+ getout_preserve_modified(1);
#endif
# if defined(HAVE_SETSID) || defined(HAVE_SETPGID)
@@ -309,7 +309,7 @@ gui_do_fork(void)
/* If we failed to start the GUI, exit now. */
if (!gui.in_use)
- exit(1);
+ getout_preserve_modified(1);
}
/*
diff --git a/src/main.c b/src/main.c
index 8c7d3d68b..83e55d1a7 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1355,7 +1355,7 @@ main_loop(
}
-#if defined(USE_XSMP) || defined(FEAT_GUI_MSWIN) || defined(PROTO)
+#if defined(USE_XSMP) || defined(FEAT_GUI) || defined(PROTO)
/*
* Exit, but leave behind swap files for modified buffers.
*/
@@ -1377,7 +1377,9 @@ getout_preserve_modified(int exitval)
#endif
-/* Exit properly */
+/*
+ * Exit properly.
+ */
void
getout(int exitval)
{
diff --git a/src/version.c b/src/version.c
index 4d0c25046..73798755f 100644
--- a/src/version.c
+++ b/src/version.c
@@ -749,6 +749,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 1598,
+/**/
1597,
/**/
1596,