rigidbody: Remove constraint when removing one of it's objects

This is not the nicest behaviour but trying to keep both bullet and
blender side objects in sync breaks in this case.
There might be a better soluion but this avoids crashes for now.

Fixes: [#35995] Delete crash on specific scene (Physics)
This commit is contained in:
Sergej Reich
2013-07-04 08:52:24 +00:00
parent 5fc8393dee
commit 734e49ade6

View File

@@ -914,12 +914,10 @@ void BKE_rigidbody_remove_object(Scene *scene, Object *ob)
if (obt && obt->rigidbody_constraint) {
rbc = obt->rigidbody_constraint;
if (rbc->ob1 == ob) {
rbc->ob1 = NULL;
rbc->flag |= RBC_FLAG_NEEDS_VALIDATE;
BKE_rigidbody_remove_constraint(scene, obt);
}
if (rbc->ob2 == ob) {
rbc->ob2 = NULL;
rbc->flag |= RBC_FLAG_NEEDS_VALIDATE;
BKE_rigidbody_remove_constraint(scene, obt);
}
}
}