[Bf-blender-cvs] [651f76b3841] blender2.8: Depsgrpah: Fix crash when removing object

Sergey Sharybin noreply at git.blender.org
Wed Oct 18 16:43:52 CEST 2017


Commit: 651f76b384150b82bb57208353ffe213bd54c72c
Author: Sergey Sharybin
Date:   Wed Oct 18 16:43:40 2017 +0200
Branches: blender2.8
https://developer.blender.org/rB651f76b384150b82bb57208353ffe213bd54c72c

Depsgrpah: Fix crash when removing object

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

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

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

diff --git a/source/blender/depsgraph/intern/depsgraph.cc b/source/blender/depsgraph/intern/depsgraph.cc
index fe4621d2ed4..a20a0c2bb31 100644
--- a/source/blender/depsgraph/intern/depsgraph.cc
+++ b/source/blender/depsgraph/intern/depsgraph.cc
@@ -309,24 +309,26 @@ IDDepsNode *Depsgraph::add_id_node(ID *id, bool do_tag, ID *id_cow_hint)
 
 void Depsgraph::clear_id_nodes()
 {
-	/* Stupid workaround to ensure we free IDs in a proper order. */
-	GHASH_FOREACH_BEGIN(IDDepsNode *, id_node, id_hash)
-	{
-		if (id_node->id_cow == NULL) {
-			/* This means builder "stole" ownership of the copy-on-written
-			 * datablock for her own dirty needs.
-			 */
-			continue;
-		}
-		if (!deg_copy_on_write_is_expanded(id_node->id_cow)) {
-			continue;
-		}
-		const ID_Type id_type = GS(id_node->id_cow->name);
-		if (id_type != ID_PA) {
-			id_node->destroy();
+	if (use_copy_on_write) {
+		/* Stupid workaround to ensure we free IDs in a proper order. */
+		GHASH_FOREACH_BEGIN(IDDepsNode *, id_node, id_hash)
+		{
+			if (id_node->id_cow == NULL) {
+				/* This means builder "stole" ownership of the copy-on-written
+				 * datablock for her own dirty needs.
+				 */
+				continue;
+			}
+			if (!deg_copy_on_write_is_expanded(id_node->id_cow)) {
+				continue;
+			}
+			const ID_Type id_type = GS(id_node->id_cow->name);
+			if (id_type != ID_PA) {
+				id_node->destroy();
+			}
 		}
+		GHASH_FOREACH_END();
 	}
-	GHASH_FOREACH_END();
 	GHASH_FOREACH_BEGIN(IDDepsNode *, id_node, id_hash)
 	{
 		OBJECT_GUARDED_DELETE(id_node, IDDepsNode);



More information about the Bf-blender-cvs mailing list