From a5aff907877bda4cf27964b56963fe5842eca44c Mon Sep 17 00:00:00 2001 From: Chris Yang Date: Fri, 31 May 2024 13:44:33 -0700 Subject: [PATCH 1/2] bail if invalid cleanup check freed --- modules/gdscript/gdscript_editor.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/modules/gdscript/gdscript_editor.cpp b/modules/gdscript/gdscript_editor.cpp index 11d4a4002cb2..37a6f5b9947a 100644 --- a/modules/gdscript/gdscript_editor.cpp +++ b/modules/gdscript/gdscript_editor.cpp @@ -403,6 +403,11 @@ void GDScriptLanguage::debug_get_globals(List *p_globals, List const Variant &var = gl_array[E.value]; if (Object *obj = var) { + bool freed = false; + var.get_validated_object_with_check(freed); + if (freed) { + continue; + } if (Object::cast_to(obj)) { continue; } From 0e4d0a22a63fdc50110be3e743ee5e73a4247e4b Mon Sep 17 00:00:00 2001 From: Chris Yang Date: Sat, 1 Jun 2024 05:40:17 -0700 Subject: [PATCH 2/2] review fix: refactor --- modules/gdscript/gdscript_editor.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/modules/gdscript/gdscript_editor.cpp b/modules/gdscript/gdscript_editor.cpp index 37a6f5b9947a..5f95358a31bc 100644 --- a/modules/gdscript/gdscript_editor.cpp +++ b/modules/gdscript/gdscript_editor.cpp @@ -402,9 +402,8 @@ void GDScriptLanguage::debug_get_globals(List *p_globals, List } const Variant &var = gl_array[E.value]; - if (Object *obj = var) { - bool freed = false; - var.get_validated_object_with_check(freed); + bool freed = false; + if (Object *obj = var.get_validated_object_with_check(freed)) { if (freed) { continue; }