summaryrefslogtreecommitdiff
path: root/src/screen.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2014-11-27 13:37:10 +0100
committerBram Moolenaar <Bram@vim.org>2014-11-27 13:37:10 +0100
commitcbdf0a0b4adc19fb443bb7df542578c3e76970ce (patch)
tree6e58956896447bc1fe45a2e8d7b578f9dc438024 /src/screen.c
parent8c731505b094bdad100484373387b4c4658300d5 (diff)
downloadvim-git-cbdf0a0b4adc19fb443bb7df542578c3e76970ce.tar.gz
updated for version 7.4.528v7.4.528
Problem: Crash when using matchadd() (Yasuhiro Matsumoto) Solution: Copy the match regprog.
Diffstat (limited to 'src/screen.c')
-rw-r--r--src/screen.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/screen.c b/src/screen.c
index e11bdc377..d39513862 100644
--- a/src/screen.c
+++ b/src/screen.c
@@ -7588,6 +7588,12 @@ next_search_hl(win, shl, lnum, mincol, cur)
shl->lnum = lnum;
if (shl->rm.regprog != NULL)
{
+ /* Remember whether shl->rm is using a copy of the regprog in
+ * cur->match. */
+ int regprog_is_copy = (shl != &search_hl && cur != NULL
+ && shl == &cur->hl
+ && cur->match.regprog == cur->hl.rm.regprog);
+
nmatched = vim_regexec_multi(&shl->rm, win, shl->buf, lnum,
matchcol,
#ifdef FEAT_RELTIME
@@ -7596,6 +7602,10 @@ next_search_hl(win, shl, lnum, mincol, cur)
NULL
#endif
);
+ /* Copy the regprog, in case it got freed and recompiled. */
+ if (regprog_is_copy)
+ cur->match.regprog = cur->hl.rm.regprog;
+
if (called_emsg || got_int)
{
/* Error while handling regexp: stop using this regexp. */