]> granicus.if.org Git - vim/commitdiff
patch 8.2.4643: Vim9: variable may be locked unintentionally v8.2.4643
authorBram Moolenaar <Bram@vim.org>
Mon, 28 Mar 2022 17:16:52 +0000 (18:16 +0100)
committerBram Moolenaar <Bram@vim.org>
Mon, 28 Mar 2022 17:16:52 +0000 (18:16 +0100)
Problem:    Vim9: variable may be locked unintentionally.
Solution:   Clear "v_lock". (closes #10036)

src/testdir/test_vim9_builtin.vim
src/version.c
src/vim9execute.c

index 24a7f9583e7aba4a6151d1805f321a28ae2b46bb..01f29d9d2bcfd701dadeb0ec0c26596ef6909281 100644 (file)
@@ -371,10 +371,17 @@ def Test_bufname()
   assert_fails('bufname([])', 'E1220:')
 enddef
 
+let s:bufnr_res = 0
+
 def Test_bufnr()
   var buf = bufnr()
   bufnr('%')->assert_equal(buf)
 
+  # check the lock is not taken over through the stack
+  const nr = 10
+  bufnr_res = bufnr()
+  bufnr_res = 12345
+
   buf = bufnr('Xdummy', true)
   buf->assert_notequal(-1)
   exe 'bwipe! ' .. buf
index 9d3afeb1657a2b68ca15fc0c8a0b263664cccd99..fe7f299cbd8eaf5325addaddeaabbe6ce1a11679 100644 (file)
@@ -750,6 +750,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    4643,
 /**/
     4642,
 /**/
index a95a488068b87563215efc2a7a1493bdf1141560..c5dc30da04322ef202c2482409d1aac093551aa1 100644 (file)
@@ -937,6 +937,7 @@ call_prepare(int argcount, typval_T *argvars, ectx_T *ectx)
     tv = STACK_TV_BOT(-1);
     tv->v_type = VAR_NUMBER;
     tv->vval.v_number = 0;
+    tv->v_lock = 0;
 
     return OK;
 }