patch 9.1.1592: Vim9: crash with classes and garbage collection

Commit: 
https://github.com/vim/vim/commit/688ebe596d1d6b3d8284de5572ce502d22d20b78
Author: Yegappan Lakshmanan <yegap...@yahoo.com>
Date:   Tue Aug 5 19:17:51 2025 +0200

    patch 9.1.1592: Vim9: crash with classes and garbage collection
    
    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 <yegap...@yahoo.com>
    Signed-off-by: Christian Brabandt <c...@256bit.org>

diff --git a/src/version.c b/src/version.c
index cb6454639..fecf9219f 100644
--- a/src/version.c
+++ b/src/version.c
@@ -719,6 +719,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1592,
 /**/
     1591,
 /**/
diff --git a/src/vim9class.c b/src/vim9class.c
index aa68a6dc8..40b594af7 100644
--- a/src/vim9class.c
+++ b/src/vim9class.c
@@ -3714,7 +3714,8 @@ class_get_selfrefs(class_T *cl)
     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++;

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
To view this discussion visit 
https://groups.google.com/d/msgid/vim_dev/E1ujLUF-00ELIN-L7%40256bit.org.

Raspunde prin e-mail lui