diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-05-04 09:52:14 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-05-04 09:52:14 +0400 |
commit | ea5b43d862a4004280660405d50560d576f6fed9 (patch) | |
tree | 00c3419ef8a7f3af173b18ce5a4729fb3693e910 /source/blender/makesrna/intern/rna_pose.c | |
parent | b5c2598a6b31f63ee6d52c61d6ab5195a576ec56 (diff) |
fix [#26920] working with bones causes segmetation fault.
ITASC IK solver data wasn't being cleared when constraints were removed, would access freed memory and crash.
Diffstat (limited to 'source/blender/makesrna/intern/rna_pose.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_pose.c | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/source/blender/makesrna/intern/rna_pose.c b/source/blender/makesrna/intern/rna_pose.c index 9b8b23e3c47..7c5c4882253 100644 --- a/source/blender/makesrna/intern/rna_pose.c +++ b/source/blender/makesrna/intern/rna_pose.c @@ -470,11 +470,22 @@ static void rna_PoseChannel_constraints_remove(ID *id, bPoseChannel *pchan, Repo BKE_reportf(reports, RPT_ERROR, "Constraint '%s' not found in pose bone '%s'.", con->name, pchan->name); return; } + else { + Object *ob= (Object *)id; + const short is_ik= ELEM(con->type, CONSTRAINT_TYPE_KINEMATIC, CONSTRAINT_TYPE_SPLINEIK); + + remove_constraint(&pchan->constraints, con); + + ED_object_constraint_update(ob); + + constraints_set_active(&pchan->constraints, NULL); - // TODO - //ED_object_constraint_set_active(id, NULL); - WM_main_add_notifier(NC_OBJECT|ND_CONSTRAINT, id); - remove_constraint(&pchan->constraints, con); + if (is_ik) { + BIK_clear_data(ob->pose); + } + + WM_main_add_notifier(NC_OBJECT|ND_CONSTRAINT|NA_REMOVED, id); + } } static int rna_PoseChannel_proxy_editable(PointerRNA *ptr) |