Mercurial > vim
comparison src/os_unix.c @ 14573:738e9d1ac4d2 v8.1.0300
patch 8.1.0300: the old window title might be freed twice
commit https://github.com/vim/vim/commit/d8f0cef2bdbdc15d7906f991725e09e67c97cf7e
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Aug 19 22:20:16 2018 +0200
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.
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sun, 19 Aug 2018 22:30:05 +0200 |
parents | 80f715651c4c |
children | 33d751f40e4c |
comparison
equal
deleted
inserted
replaced
14572:7bf554378133 | 14573:738e9d1ac4d2 |
---|---|
159 #ifdef FEAT_TITLE | 159 #ifdef FEAT_TITLE |
160 static int get_x11_title(int); | 160 static int get_x11_title(int); |
161 static int get_x11_icon(int); | 161 static int get_x11_icon(int); |
162 | 162 |
163 static char_u *oldtitle = NULL; | 163 static char_u *oldtitle = NULL; |
164 static volatile int oldtitle_outdated = FALSE; | |
164 static int did_set_title = FALSE; | 165 static int did_set_title = FALSE; |
165 static char_u *oldicon = NULL; | 166 static char_u *oldicon = NULL; |
166 static int did_set_icon = FALSE; | 167 static int did_set_icon = FALSE; |
167 #endif | 168 #endif |
168 | 169 |
1229 | 1230 |
1230 static void | 1231 static void |
1231 after_sigcont(void) | 1232 after_sigcont(void) |
1232 { | 1233 { |
1233 # ifdef FEAT_TITLE | 1234 # ifdef FEAT_TITLE |
1234 // Set oldtitle to NULL, so the current title is obtained again. | 1235 // Don't change "oldtitle" in a signal handler, set a flag to obtain it |
1235 VIM_CLEAR(oldtitle); | 1236 // again later. |
1237 oldtitle_outdated = TRUE; | |
1236 # endif | 1238 # endif |
1237 settmode(TMODE_RAW); | 1239 settmode(TMODE_RAW); |
1238 need_check_timestamps = TRUE; | 1240 need_check_timestamps = TRUE; |
1239 did_check_timestamps = FALSE; | 1241 did_check_timestamps = FALSE; |
1240 } | 1242 } |
2279 * Note: if "t_ts" is set, title is set with escape sequence rather | 2281 * Note: if "t_ts" is set, title is set with escape sequence rather |
2280 * than x11 calls, because the x11 calls don't always work | 2282 * than x11 calls, because the x11 calls don't always work |
2281 */ | 2283 */ |
2282 if ((type || *T_TS != NUL) && title != NULL) | 2284 if ((type || *T_TS != NUL) && title != NULL) |
2283 { | 2285 { |
2286 if (oldtitle_outdated) | |
2287 { | |
2288 oldtitle_outdated = FALSE; | |
2289 VIM_CLEAR(oldtitle); | |
2290 } | |
2284 if (oldtitle == NULL | 2291 if (oldtitle == NULL |
2285 #ifdef FEAT_GUI | 2292 #ifdef FEAT_GUI |
2286 && !gui.in_use | 2293 && !gui.in_use |
2287 #endif | 2294 #endif |
2288 ) /* first call but not in GUI, save title */ | 2295 ) /* first call but not in GUI, save title */ |