patch 8.2.0720: occasional exit when encountering an X error
Problem: Occasional exit when encountering an X error. (Manfred Lotz)
Solution: On an X error do not exit, do preserve files.
diff --git a/src/os_unix.c b/src/os_unix.c
index f8fe2cb..8424b11 100644
--- a/src/os_unix.c
+++ b/src/os_unix.c
@@ -1544,10 +1544,15 @@
XGetErrorText(dpy, error_event->error_code, (char *)IObuff, IOSIZE);
STRCAT(IObuff, _("\nVim: Got X error\n"));
- // We cannot print a message and continue, because no X calls are allowed
- // here (causes my system to hang). Silently continuing might be an
- // alternative...
- preserve_exit(); // preserve files and exit
+ // In the GUI we cannot print a message and continue, because no X calls
+ // are allowed here (causes my system to hang). Silently continuing seems
+ // like the best alternative. Do preserve files, in case we crash.
+ ml_sync_all(FALSE, FALSE);
+
+#ifdef FEAT_GUI
+ if (!gui.in_use)
+#endif
+ msg((char *)IObuff);
return 0; // NOTREACHED
}