[Bf-blender-cvs] [8da7ab11cf6] blender-v2.83-release: Fix T76053: Rigid Body properties disappears after deleting rigid body constraint object and undoing.

Bastien Montagne noreply at git.blender.org
Tue May 12 16:16:07 CEST 2020


Commit: 8da7ab11cf63d36577b5bd1e96bae637b0bd464c
Author: Bastien Montagne
Date:   Tue May 12 16:10:21 2020 +0200
Branches: blender-v2.83-release
https://developer.blender.org/rB8da7ab11cf63d36577b5bd1e96bae637b0bd464c

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.

===================================================================

M	source/blender/blenkernel/intern/scene.c

===================================================================

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);
   }



More information about the Bf-blender-cvs mailing list