patch 8.1.0300: the old window title might be freed twice
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.
diff --git a/src/os_unix.c b/src/os_unix.c
index 148d8a4..b044df2 100644
--- a/src/os_unix.c
+++ b/src/os_unix.c
@@ -161,6 +161,7 @@
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 @@
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 @@
*/
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
diff --git a/src/version.c b/src/version.c
index 7278799..e7ea55f 100644
--- a/src/version.c
+++ b/src/version.c
@@ -795,6 +795,8 @@
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 300,
+/**/
299,
/**/
298,