From: Bram Moolenaar Date: Wed, 1 Jun 2016 20:21:06 +0000 (+0200) Subject: patch 7.4.1866 X-Git-Tag: v7.4.1866 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a96732150cda2f242133228579b05437a39b8daa;p=vim patch 7.4.1866 Problem: Invalid memory access when exiting with EXITFREE defined. (Dominique Pelle) Solution: Set "really_exiting" and skip error messages. --- diff --git a/src/eval.c b/src/eval.c index 3d0abf369..a49d54bd0 100644 --- a/src/eval.c +++ b/src/eval.c @@ -25348,7 +25348,11 @@ func_unref(char_u *name) { fp = find_func(name); if (fp == NULL) - EMSG2(_(e_intern2), "func_unref()"); + { + /* Ignore when invoked through free_all_mem(). */ + if (!really_exiting) + EMSG2(_(e_intern2), "func_unref()"); + } else if (--fp->uf_refcount <= 0) { /* Only delete it when it's not being used. Otherwise it's done diff --git a/src/misc2.c b/src/misc2.c index b4e94795f..f7b1de30d 100644 --- a/src/misc2.c +++ b/src/misc2.c @@ -1044,6 +1044,9 @@ free_all_mem(void) return; entered = TRUE; + /* Set this flag to indicate some errors can be ignored. */ + really_exiting = TRUE; + # ifdef FEAT_AUTOCMD /* Don't want to trigger autocommands from here on. */ block_autocmds(); diff --git a/src/version.c b/src/version.c index 7952a140c..f9305d515 100644 --- a/src/version.c +++ b/src/version.c @@ -753,6 +753,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1866, /**/ 1865, /**/