From 1feaa450cb024a4cd4eb3ae7ab7e5db683909488 Mon Sep 17 00:00:00 2001 From: James McCoy Date: Sun, 1 Jan 2017 22:34:17 -0500 Subject: vim-patch:7.4.1866 Problem: Invalid memory access when exiting with EXITFREE defined. (Dominique Pelle) Solution: Set "really_exiting" and skip error messages. https://github.com/vim/vim/commit/a96732150cda2f242133228579b05437a39b8daa This fails to build, due to a00c2e0ecbaec366364cecb5efbdb456c8c543ef removing really_exiting from globals.h, but the next commit fixes the build failure. --- src/nvim/eval.c | 5 ++++- src/nvim/memory.c | 3 +++ src/nvim/version.c | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/nvim/eval.c b/src/nvim/eval.c index 32e1991742..c900cf5dfb 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -21569,7 +21569,10 @@ void func_unref(char_u *name) if (name != NULL && isdigit(*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 { user_func_unref(fp); } diff --git a/src/nvim/memory.c b/src/nvim/memory.c index 071ef335cf..63914f3a46 100644 --- a/src/nvim/memory.c +++ b/src/nvim/memory.c @@ -496,6 +496,9 @@ void free_all_mem(void) return; entered = true; + // Set this flag to indicate some errors can be ignored. + really_exiting = true; + // Don't want to trigger autocommands from here on. block_autocmds(); diff --git a/src/nvim/version.c b/src/nvim/version.c index 9f2b7a26c3..7244a53606 100644 --- a/src/nvim/version.c +++ b/src/nvim/version.c @@ -574,7 +574,7 @@ static int included_patches[] = { // 1869 NA // 1868, 1867, - // 1866, + 1866, // 1865 NA // 1864 NA // 1863 NA -- cgit