diff options
author | Bram Moolenaar <Bram@vim.org> | 2017-09-09 15:28:14 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2017-09-09 15:28:14 +0200 |
commit | b4ea1914b8ca7c368253bd96e6b3cb9e3392da1c (patch) | |
tree | 92e37c9cd9dddca2b3898ba464b7f54fa64c97e0 /src | |
parent | fe386641b0c56c5de2bca8e1f4cd5e2a1f1aea7e (diff) | |
download | vim-b4ea1914b8ca7c368253bd96e6b3cb9e3392da1c.zip |
patch 8.0.1078: using freed memory with ":hi Normal"
Problem: Using freed memory with ":hi Normal".
Solution: Get "item" again after updating the table.
Diffstat (limited to 'src')
-rw-r--r-- | src/syntax.c | 17 | ||||
-rw-r--r-- | src/version.c | 2 |
2 files changed, 17 insertions, 2 deletions
diff --git a/src/syntax.c b/src/syntax.c index ded6cd33d..1a425f76a 100644 --- a/src/syntax.c +++ b/src/syntax.c @@ -7381,6 +7381,9 @@ do_highlight( # define is_menu_group 0 # define is_tooltip_group 0 #endif +#if defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS) + int did_highlight_changed = FALSE; +#endif /* * If no argument, list current highlighting. @@ -7568,8 +7571,9 @@ do_highlight( #if defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS) if (USE_24BIT) highlight_gui_started(); + else #endif - highlight_changed(); + highlight_changed(); redraw_later_clear(); return; } @@ -8174,7 +8178,12 @@ do_highlight( #endif #if defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS) if (USE_24BIT) + { highlight_gui_started(); + item = &HL_TABLE()[idx]; /* table may have changed */ + did_highlight_changed = TRUE; + redraw_all_later(NOT_VALID); + } #endif } #ifdef FEAT_GUI_X11 @@ -8210,7 +8219,11 @@ do_highlight( /* Only call highlight_changed() once, after a sequence of highlight * commands, and only if an attribute actually changed. */ - if (memcmp(item, &item_before, sizeof(item_before)) != 0) + if (memcmp(item, &item_before, sizeof(item_before)) != 0 +#if defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS) + && !did_highlight_changed +#endif + ) { redraw_all_later(NOT_VALID); need_highlight_changed = TRUE; diff --git a/src/version.c b/src/version.c index a54e153b2..4ef0d9ee7 100644 --- a/src/version.c +++ b/src/version.c @@ -770,6 +770,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 1078, +/**/ 1077, /**/ 1076, |