diff options
author | Bastien Montagne <bastien@blender.org> | 2020-05-12 17:10:21 +0300 |
---|---|---|
committer | Bastien Montagne <bastien@blender.org> | 2020-05-12 17:13:52 +0300 |
commit | 8da7ab11cf63d36577b5bd1e96bae637b0bd464c (patch) | |
tree | 4146c4a1e4a2681a95c1468e71a81dad1e48b2b7 | |
parent | 08b4c9a815c0426bbba9738bce1b10ea4acdaf48 (diff) |
Fix T76053: Rigid Body properties disappears after deleting rigid body constraint object and undoing.
Since we re-use same addresses of IDs with newly read data, and never
remap old IDs to 'proper' 'old' ID pointers, it implies that old IDs
being deleted will have many ID pointers to new, valid data that we want
to keep.
In general anyway, code from IDTypeInfo (i.e. low-level ID management
code) should never do anything outside of its own ID scope, we cannot
guarantee that given ID is in fully valid state regarding its relations
to other data-blocks.
-rw-r--r-- | source/blender/blenkernel/intern/scene.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c index f7c018edbd8..72d85f596ec 100644 --- a/source/blender/blenkernel/intern/scene.c +++ b/source/blender/blenkernel/intern/scene.c @@ -346,6 +346,11 @@ static void scene_free_data(ID *id) } if (scene->rigidbody_world) { + /* Prevent rigidbody freeing code to follow other IDs pointers, this should never be allowed + * nor necessary from here, and with new undo code, those pointers may be fully invalid or + * worse, pointing to data actually belonging to new BMain! */ + scene->rigidbody_world->constraints = NULL; + scene->rigidbody_world->group = NULL; BKE_rigidbody_free_world(scene); } |