aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJan Edmund Lazo <janedmundlazo@hotmail.com>2018-07-25 23:36:32 -0400
committerJan Edmund Lazo <janedmundlazo@hotmail.com>2018-07-29 07:52:45 -0400
commitf0ca2283b08aa1f43eb14d6d4bae18272c2111f1 (patch)
tree4784961b0be3dd613a4057fbd02cdab69626a49c /src
parent6b7b56dabe33a9f48c14a5d075b7796c0d2f3bb5 (diff)
downloadrneovim-f0ca2283b08aa1f43eb14d6d4bae18272c2111f1.tar.gz
rneovim-f0ca2283b08aa1f43eb14d6d4bae18272c2111f1.tar.bz2
rneovim-f0ca2283b08aa1f43eb14d6d4bae18272c2111f1.zip
vim-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. https://github.com/vim/vim/commit/b4ea1914b8ca7c368253bd96e6b3cb9e3392da1c
Diffstat (limited to 'src')
-rw-r--r--src/nvim/syntax.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/nvim/syntax.c b/src/nvim/syntax.c
index dcac907c5a..39a2abe03d 100644
--- a/src/nvim/syntax.c
+++ b/src/nvim/syntax.c
@@ -6500,6 +6500,7 @@ void do_highlight(const char *line, const bool forceit, const bool init)
bool error = false;
int color;
bool is_normal_group = false; // "Normal" group
+ bool did_highlight_changed = false;
// If no argument, list current highlighting.
if (ends_excmd((uint8_t)(*line))) {
@@ -6944,6 +6945,9 @@ void do_highlight(const char *line, const bool forceit, const bool init)
// redraw below will still handle usages of guibg=fg etc.
ui_default_colors_set();
}
+ item = &HL_TABLE()[idx];
+ did_highlight_changed = true;
+ redraw_all_later(NOT_VALID);
} else {
set_hl_attr(idx);
}
@@ -6954,7 +6958,8 @@ void do_highlight(const char *line, const bool forceit, const bool init)
// 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
+ && !did_highlight_changed) {
redraw_all_later(NOT_VALID);
need_highlight_changed = true;
}