diff options
author | Bastien Montagne <bastien@blender.org> | 2020-10-02 17:12:27 +0300 |
---|---|---|
committer | Bastien Montagne <bastien@blender.org> | 2020-10-02 18:40:51 +0300 |
commit | f3934523946962b807b0dd7e0863a437cfc56e27 (patch) | |
tree | 3566da5d6e4eb63816c7b56334821227d1b356de /source | |
parent | 619e52eb82744c9dc2a403a0aa12fa9e9141fe3b (diff) |
Fix T81345, part two: crash in depsgraph when freeing COW armature.
Freeing of bones' IDproerties from Armature `free_data` callback would always
attempt to do user refcounting, which should never be done from that code.
This would generate crashes in depsgraph/COW context e.g.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenkernel/BKE_armature.h | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/armature.c | 8 | ||||
-rw-r--r-- | source/blender/editors/armature/armature_utils.c | 2 |
3 files changed, 6 insertions, 6 deletions
diff --git a/source/blender/blenkernel/BKE_armature.h b/source/blender/blenkernel/BKE_armature.h index d7ed92b69b7..975190f0fb5 100644 --- a/source/blender/blenkernel/BKE_armature.h +++ b/source/blender/blenkernel/BKE_armature.h @@ -141,7 +141,7 @@ typedef struct PoseTree { struct bArmature *BKE_armature_add(struct Main *bmain, const char *name); struct bArmature *BKE_armature_from_object(struct Object *ob); int BKE_armature_bonelist_count(struct ListBase *lb); -void BKE_armature_bonelist_free(struct ListBase *lb); +void BKE_armature_bonelist_free(struct ListBase *lb, const bool do_id_user); struct bArmature *BKE_armature_copy(struct Main *bmain, const struct bArmature *arm); void BKE_armature_copy_bone_transforms(struct bArmature *armature_dst, diff --git a/source/blender/blenkernel/intern/armature.c b/source/blender/blenkernel/intern/armature.c index af9ce7c34ac..3d91d22e139 100644 --- a/source/blender/blenkernel/intern/armature.c +++ b/source/blender/blenkernel/intern/armature.c @@ -139,7 +139,7 @@ static void armature_free_data(struct ID *id) bArmature *armature = (bArmature *)id; BKE_armature_bone_hash_free(armature); - BKE_armature_bonelist_free(&armature->bonebase); + BKE_armature_bonelist_free(&armature->bonebase, false); /* free editmode data */ if (armature->edbo) { @@ -357,15 +357,15 @@ int BKE_armature_bonelist_count(ListBase *lb) return i; } -void BKE_armature_bonelist_free(ListBase *lb) +void BKE_armature_bonelist_free(ListBase *lb, const bool do_id_user) { Bone *bone; for (bone = lb->first; bone; bone = bone->next) { if (bone->prop) { - IDP_FreeProperty(bone->prop); + IDP_FreeProperty_ex(bone->prop, do_id_user); } - BKE_armature_bonelist_free(&bone->childbase); + BKE_armature_bonelist_free(&bone->childbase, do_id_user); } BLI_freelistN(lb); diff --git a/source/blender/editors/armature/armature_utils.c b/source/blender/editors/armature/armature_utils.c index 1c8c5ba9d94..29df8b31819 100644 --- a/source/blender/editors/armature/armature_utils.c +++ b/source/blender/editors/armature/armature_utils.c @@ -695,7 +695,7 @@ void ED_armature_from_edit(Main *bmain, bArmature *arm) /* armature bones */ BKE_armature_bone_hash_free(arm); - BKE_armature_bonelist_free(&arm->bonebase); + BKE_armature_bonelist_free(&arm->bonebase, true); arm->act_bone = NULL; /* remove zero sized bones, this gives unstable restposes */ |