Fix Godot 4.7 typed array crash: add freed-object filtering in PropertyPool and PerObjectHistory

This commit is contained in:
2026-07-03 16:09:59 -04:00
parent fc2c0236cb
commit 5a1695e2ab
3 changed files with 22 additions and 3 deletions
@@ -11,8 +11,14 @@ func _init(p_history_size: int):
_history_size = p_history_size
func subjects() -> Array[Object]:
# Filter out freed objects — Godot 4.7 stricter typed arrays
# reject invalid references and crash the engine.
var valid := []
for o in _data.keys():
if is_instance_valid(o):
valid.append(o)
var result := [] as Array[Object]
result.assign(_data.keys())
result.assign(valid)
return result
func is_auth(tick: int, subject: Object) -> bool:
+7 -1
View File
@@ -49,8 +49,14 @@ func get_properties_of(subject: Object) -> Array[NodePath]:
return properties
func get_subjects() -> Array[Object]:
# Filter out freed objects — Godot 4.7 stricter typed arrays
# reject invalid references and crash the engine.
var valid := []
for s in _properties_by_subject.keys():
if is_instance_valid(s):
valid.append(s)
var subjects := [] as Array[Object]
subjects.assign(_properties_by_subject.keys())
subjects.assign(valid)
return subjects
func is_empty() -> bool: