Mercurial > vim
changeset 6394:5f49ac8426df v7.4.528
updated for version 7.4.528
Problem: Crash when using matchadd() (Yasuhiro Matsumoto)
Solution: Copy the match regprog.
author | Bram Moolenaar <bram@vim.org> |
---|---|
date | Thu, 27 Nov 2014 13:37:10 +0100 |
parents | 661e95466448 |
children | 7d1f870dfe73 |
files | src/screen.c src/version.c |
diffstat | 2 files changed, 12 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/screen.c +++ b/src/screen.c @@ -7588,6 +7588,12 @@ next_search_hl(win, shl, lnum, mincol, c 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, c 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. */