[Bf-blender-cvs] [61d1fd7e2f8] blender-v2.92-release: Fix T85142: BMW scene quits Blender

Sergey Sharybin noreply at git.blender.org
Thu Jan 28 10:34:24 CET 2021


Commit: 61d1fd7e2f8b972b903fa6684114a13f652fd507
Author: Sergey Sharybin
Date:   Thu Jan 28 10:20:43 2021 +0100
Branches: blender-v2.92-release
https://developer.blender.org/rB61d1fd7e2f8b972b903fa6684114a13f652fd507

Fix T85142: BMW scene quits Blender

Technically, the crash was caused by revert which happened in
rBcd24712c2c5: it reverted some code which is essential for
rB76fd41e9db1.

Bring back the essential code for the removal of un-needed
Copy-on-Write operations, so that the crash doesn't happen.

What was causing the crash is the ID tag assuming Copy-on-Write
operation always exists.

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

M	source/blender/depsgraph/intern/depsgraph.cc
M	source/blender/depsgraph/intern/depsgraph_tag.cc

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

diff --git a/source/blender/depsgraph/intern/depsgraph.cc b/source/blender/depsgraph/intern/depsgraph.cc
index 17eeba55a27..3d30e7e79b9 100644
--- a/source/blender/depsgraph/intern/depsgraph.cc
+++ b/source/blender/depsgraph/intern/depsgraph.cc
@@ -142,6 +142,14 @@ static void clear_id_nodes_conditional(Depsgraph::IDDepsNodes *id_nodes, const F
        * datablock for her own dirty needs. */
       continue;
     }
+    if (id_node->id_cow == id_node->id_orig) {
+      /* Copy-on-write version is not needed for this ID type.
+       *
+       * NOTE: Is important to not de-reference the original datablock here because it might be
+       * freed already (happens during main database free when some IDs are freed prior to a
+       * scene). */
+      continue;
+    }
     if (!deg_copy_on_write_is_expanded(id_node->id_cow)) {
       continue;
     }
diff --git a/source/blender/depsgraph/intern/depsgraph_tag.cc b/source/blender/depsgraph/intern/depsgraph_tag.cc
index 95ee8234ef3..c60ec4351bc 100644
--- a/source/blender/depsgraph/intern/depsgraph_tag.cc
+++ b/source/blender/depsgraph/intern/depsgraph_tag.cc
@@ -265,6 +265,10 @@ void depsgraph_update_editors_tag(Main *bmain, Depsgraph *graph, ID *id)
 void depsgraph_id_tag_copy_on_write(Depsgraph *graph, IDNode *id_node, eUpdateSource update_source)
 {
   ComponentNode *cow_comp = id_node->find_component(NodeType::COPY_ON_WRITE);
+  if (cow_comp == nullptr) {
+    BLI_assert(!deg_copy_on_write_is_needed(GS(id_node->id_orig->name)));
+    return;
+  }
   cow_comp->tag_update(graph, update_source);
 }



More information about the Bf-blender-cvs mailing list