From bebdb6c8249939623f80cc72433aa7d7418444bf Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Fri, 4 Oct 2019 18:51:00 +0200 Subject: Fix assert when deleting a RBW constraint object. Side-reported in T70505. Code did not ensure deleted object was removed from the RBW constraints collection, leading to some invalid status (object in constraints collection but without relevant contraints data). Also fixed another issue - code deleting RBW objects would try to remove any constraint one using it as target, in a very bad and broken way, since you cannot iterate over objects of a collection while removing some... Now instead just NULLify relevant pointers... I hope it works, otherwise we'll have to take a different approach. Needless to stress again how weak the whole RBW code is in general, and regarding same object being used by RBW in more than one scene in particular, that is known broken situation anyway. --- source/blender/blenkernel/BKE_rigidbody.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'source/blender/blenkernel/BKE_rigidbody.h') diff --git a/source/blender/blenkernel/BKE_rigidbody.h b/source/blender/blenkernel/BKE_rigidbody.h index 4c023f54e04..b4c440d54a6 100644 --- a/source/blender/blenkernel/BKE_rigidbody.h +++ b/source/blender/blenkernel/BKE_rigidbody.h @@ -103,8 +103,14 @@ bool BKE_rigidbody_add_object(struct Main *bmain, int type, struct ReportList *reports); void BKE_rigidbody_ensure_local_object(struct Main *bmain, struct Object *ob); -void BKE_rigidbody_remove_object(struct Main *bmain, struct Scene *scene, struct Object *ob); -void BKE_rigidbody_remove_constraint(struct Scene *scene, struct Object *ob); +void BKE_rigidbody_remove_object(struct Main *bmain, + struct Scene *scene, + struct Object *ob, + const bool free_us); +void BKE_rigidbody_remove_constraint(struct Main *bmain, + struct Scene *scene, + struct Object *ob, + const bool free_us); /* -------------- */ /* Utility Macros */ -- cgit v1.2.3