From a3632694794ae78ce36302e4eac672caf771a607 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Tue, 28 Nov 2023 12:27:15 +0100 Subject: [PATCH] AnimationMixer: Validate ObjectID before blend in case the object was freed Works around #85365, but it's likely only a partial fix. The proper fix would be to remove the Object pointer from the TrackCache and always go back to the ObjectID before doing operations like this. --- scene/animation/animation_mixer.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/scene/animation/animation_mixer.cpp b/scene/animation/animation_mixer.cpp index 479311e9661..bba3dc6d7d6 100644 --- a/scene/animation/animation_mixer.cpp +++ b/scene/animation/animation_mixer.cpp @@ -1708,7 +1708,12 @@ void AnimationMixer::_blend_apply() { } } } - t->object->set_indexed(t->subpath, Animation::cast_from_blendwise(t->value, t->init_value.get_type())); + + // t->object isn't safe here, get instance from id (GH-85365). + Object *obj = ObjectDB::get_instance(t->object_id); + if (obj) { + obj->set_indexed(t->subpath, Animation::cast_from_blendwise(t->value, t->init_value.get_type())); + } } break; case Animation::TYPE_BEZIER: {