Problem: Vim9: crash with classes and garbage collection
(Christian J. Robinson, after v9.1.1566)
Solution: When getting the references to an object, make sure the object
is valid (Yegappan Lakshmanan)
closes: #17860
Signed-off-by: Yegappan Lakshmanan <yegappan@yahoo.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 1592,
/**/
1591,
/**/
for (int i = 0; i < cl->class_class_member_count; ++i)
{
tv = &cl->class_members_tv[i];
- if (tv->v_type == VAR_OBJECT && tv->vval.v_object->obj_class == cl
+ if (tv->v_type == VAR_OBJECT && tv->vval.v_object != NULL
+ && tv->vval.v_object->obj_class == cl
&& (tv->vval.v_object->obj_refcount == 1
|| (IS_ENUM(cl) && tv->vval.v_object->obj_refcount == 2)))
self_refs++;