Fix T60185: Crash on adding Inverse Kinematics

When having loops in a kinematic chain and also a IK constrain,
the solve_cycle function removes graph relations necessary to ensure
the cleanup operation was running at the very end.

Due to his Blender was crashing when some operations (the bone
constraints) accessed a pointer that was already freed.

Solved by adding more relations between crucial nodes.
This commit is contained in:
Jose C. Rubio 2019-03-13 15:13:52 +01:00 committed by Sergey Sharybin
parent eb1580961a
commit 76437b903d
Notes: blender-bot 2023-06-26 11:58:59 +02:00
Referenced by issue #60185, 2.8 Crashes on adding Inverse Kinematics
1 changed files with 9 additions and 2 deletions

View File

@ -456,7 +456,8 @@ void DepsgraphRelationBuilder::build_rig(Object *object)
NodeType::BONE,
pchan->name,
OperationCode::BONE_CONSTRAINTS);
add_relation(bone_pose_key, constraints_key, "Constraints Stack");
add_relation(bone_pose_key, constraints_key, "Pose -> Constraints Stack");
add_relation(bone_local_key, constraints_key, "Local -> Constraints Stack");
/* Constraints -> ready/ */
/* TODO(sergey): When constraint stack is exploded, this step should
* occur before the first IK solver. */
@ -518,9 +519,15 @@ void DepsgraphRelationBuilder::build_rig(Object *object)
add_relation(bone_done_key,
pose_done_key,
"PoseEval Result-Bone Link");
/* Bones must be traversed before cleanup. */
add_relation(bone_done_key,
pose_cleanup_key,
"Cleanup dependency");
"Done -> Cleanup");
add_relation(bone_ready_key,
pose_cleanup_key,
"Ready -> Cleanup");
}
/* Custom shape. */
if (pchan->custom != NULL) {