diff src/os_unix.c @ 16511:4182f74e2965 v8.1.1259

patch 8.1.1259: crash when exiting early commit https://github.com/vim/vim/commit/e5c83286bb9a72cc686f2826e605eddebe3c730c Author: Bram Moolenaar <Bram@vim.org> Date: Fri May 3 23:15:37 2019 +0200 patch 8.1.1259: crash when exiting early Problem: Crash when exiting early. (Ralf Schandl) Solution: Only pop/push the title when it was set. (closes https://github.com/vim/vim/issues/4334)
author Bram Moolenaar <Bram@vim.org>
date Fri, 03 May 2019 23:30:05 +0200
parents 42910f306377
children a72ad8a8b249
line wrap: on
line diff
--- a/src/os_unix.c
+++ b/src/os_unix.c
@@ -2205,14 +2205,19 @@ mch_settitle(char_u *title, char_u *icon
     void
 mch_restore_title(int which)
 {
+    int	do_push_pop = did_set_title || did_set_icon;
+
     /* only restore the title or icon when it has been set */
     mch_settitle(((which & SAVE_RESTORE_TITLE) && did_set_title) ?
 			(oldtitle ? oldtitle : p_titleold) : NULL,
 	       ((which & SAVE_RESTORE_ICON) && did_set_icon) ? oldicon : NULL);
 
-    // pop and push from/to the stack
-    term_pop_title(which);
-    term_push_title(which);
+    if (do_push_pop)
+    {
+	// pop and push from/to the stack
+	term_pop_title(which);
+	term_push_title(which);
+    }
 }
 
 #endif /* FEAT_TITLE */