diff options
author | Bastien Montagne <bastien@blender.org> | 2020-10-02 18:36:13 +0300 |
---|---|---|
committer | Bastien Montagne <bastien@blender.org> | 2020-10-02 18:40:51 +0300 |
commit | 4b36552967bf55b1bf707acd3917280b42b12c52 (patch) | |
tree | 37230329d155f2e91f6dd6242d2c69dcc1bfe9ba /source/blender/blenkernel/intern/armature.c | |
parent | f3934523946962b807b0dd7e0863a437cfc56e27 (diff) |
Fix T81345: part three, armature `free_data` was not handling editbones properly.
Armature freeing would not correctly free its editbone IDProperties.
Add a utils to free the whole list of edit bones, and properly handle
their potential IDProperties.
Diffstat (limited to 'source/blender/blenkernel/intern/armature.c')
-rw-r--r-- | source/blender/blenkernel/intern/armature.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/source/blender/blenkernel/intern/armature.c b/source/blender/blenkernel/intern/armature.c index 3d91d22e139..0a731f0a7f0 100644 --- a/source/blender/blenkernel/intern/armature.c +++ b/source/blender/blenkernel/intern/armature.c @@ -143,8 +143,7 @@ static void armature_free_data(struct ID *id) /* free editmode data */ if (armature->edbo) { - BLI_freelistN(armature->edbo); - + BKE_armature_editbonelist_free(armature->edbo, false); MEM_freeN(armature->edbo); armature->edbo = NULL; } @@ -371,6 +370,17 @@ void BKE_armature_bonelist_free(ListBase *lb, const bool do_id_user) BLI_freelistN(lb); } +void BKE_armature_editbonelist_free(ListBase *lb, const bool do_id_user) +{ + LISTBASE_FOREACH_MUTABLE (EditBone *, edit_bone, lb) { + if (edit_bone->prop) { + IDP_FreeProperty_ex(edit_bone->prop, do_id_user); + } + BLI_remlink_safe(lb, edit_bone); + MEM_freeN(edit_bone); + } +} + static void copy_bonechildren(Bone *bone_dst, const Bone *bone_src, const Bone *bone_src_act, |