patch 9.0.1662: crash when using a class member twice
Problem: Crash when using a class member twice. (Christian J. Robinson)
Solution: Make a copy of the value.
diff --git a/src/vim9execute.c b/src/vim9execute.c
index 921e2ca..eb663a1 100644
--- a/src/vim9execute.c
+++ b/src/vim9execute.c
@@ -3967,8 +3967,8 @@
if (GA_GROW_FAILS(&ectx->ec_stack, 1))
goto theend;
classmember_T *cm = &iptr->isn_arg.classmember;
- *STACK_TV_BOT(0) =
- cm->cm_class->class_members_tv[cm->cm_idx];
+ copy_tv(cm->cm_class->class_members_tv + cm->cm_idx,
+ STACK_TV_BOT(0));
++ectx->ec_stack.ga_len;
}
break;