diff src/evalfunc.c @ 27591:d91be28bbdbb v8.2.4322

patch 8.2.4322: Vim9: crash when using funcref with closure Commit: https://github.com/vim/vim/commit/7aca5ca6763e50d2c23953b20e30fca7457c9abf Author: Bram Moolenaar <Bram@vim.org> Date: Mon Feb 7 19:56:43 2022 +0000 patch 8.2.4322: Vim9: crash when using funcref with closure Problem: Vim9: crash when using funcref with closure. Solution: Keep a reference to the funcref that has the outer context. (closes #9716)
author Bram Moolenaar <Bram@vim.org>
date Mon, 07 Feb 2022 21:00:02 +0100
parents ecea41486e8a
children 4eb2bf8b2f27
line wrap: on
line diff
--- a/src/evalfunc.c
+++ b/src/evalfunc.c
@@ -4456,7 +4456,10 @@ common_function(typval_T *argvars, typva
 		}
 
 		if (arg_pt != NULL)
-		    pt->pt_outer = arg_pt->pt_outer;
+		{
+		    pt->pt_outer_partial = arg_pt;
+		    ++arg_pt->pt_refcount;
+		}
 	    }
 	    rettv->v_type = VAR_PARTIAL;
 	    rettv->vval.v_partial = pt;