summaryrefslogtreecommitdiff
path: root/src/os_unix.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2018-08-19 22:20:16 +0200
committerBram Moolenaar <Bram@vim.org>2018-08-19 22:20:16 +0200
commitd8f0cef2bdbdc15d7906f991725e09e67c97cf7e (patch)
tree03f8a39e6c75400070c298fde45792fbbaf632da /src/os_unix.c
parent142ae736d984f4575c1c6ec1a4f679ae4ddf9413 (diff)
downloadvim-git-d8f0cef2bdbdc15d7906f991725e09e67c97cf7e.tar.gz
patch 8.1.0300: the old window title might be freed twicev8.1.0300
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.
Diffstat (limited to 'src/os_unix.c')
-rw-r--r--src/os_unix.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/os_unix.c b/src/os_unix.c
index 148d8a499..b044df27f 100644
--- a/src/os_unix.c
+++ b/src/os_unix.c
@@ -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