]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 8.1.0300: the old window title might be freed twice v8.1.0300
authorBram Moolenaar <Bram@vim.org>
Sun, 19 Aug 2018 20:20:16 +0000 (22:20 +0200)
committerBram Moolenaar <Bram@vim.org>
Sun, 19 Aug 2018 20:20:16 +0000 (22:20 +0200)
Problem:    The old window title might be freed twice. (Dominique Pelle)
Solution:   Do not free "oldtitle" in a signal handler but set a flag to have
            it freed later.

src/os_unix.c
src/version.c

index 148d8a499c49f518ec8cc65db3737b33c71698d1..b044df27f7044751c2243276311bc7766e3335d6 100644 (file)
@@ -161,6 +161,7 @@ static int get_x11_title(int);
 static int get_x11_icon(int);
 
 static char_u  *oldtitle = NULL;
+static volatile int oldtitle_outdated = FALSE;
 static int     did_set_title = FALSE;
 static char_u  *oldicon = NULL;
 static int     did_set_icon = FALSE;
@@ -1231,8 +1232,9 @@ deathtrap SIGDEFARG(sigarg)
 after_sigcont(void)
 {
 # ifdef FEAT_TITLE
-    // Set oldtitle to NULL, so the current title is obtained again.
-    VIM_CLEAR(oldtitle);
+    // Don't change "oldtitle" in a signal handler, set a flag to obtain it
+    // again later.
+    oldtitle_outdated = TRUE;
 # endif
     settmode(TMODE_RAW);
     need_check_timestamps = TRUE;
@@ -2281,6 +2283,11 @@ mch_settitle(char_u *title, char_u *icon)
      */
     if ((type || *T_TS != NUL) && title != NULL)
     {
+       if (oldtitle_outdated)
+       {
+           oldtitle_outdated = FALSE;
+           VIM_CLEAR(oldtitle);
+       }
        if (oldtitle == NULL
 #ifdef FEAT_GUI
                && !gui.in_use
index 7278799b78c53487cd045bfe64991d2946ad3ae9..e7ea55f9d5525ca6ca65e677d253357afe1ec504 100644 (file)
@@ -794,6 +794,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    300,
 /**/
     299,
 /**/