[Bf-blender-cvs] [2c169ee] depsgraph_refactor: Depsgraph: Fix order of depsgraph destroying

Sergey Sharybin noreply at git.blender.org
Thu Dec 18 15:10:48 CET 2014


Commit: 2c169ee0f23974a93e8ba4d34e3c34a99c8c8c4b
Author: Sergey Sharybin
Date:   Thu Dec 18 19:09:08 2014 +0500
Branches: depsgraph_refactor
https://developer.blender.org/rB2c169ee0f23974a93e8ba4d34e3c34a99c8c8c4b

Depsgraph: Fix order of depsgraph destroying

First need to remove all the nodes and links, then free the root, otherwise it's
possible to access freed data on relations destroy.

This is actually much bigger can of worms i'm afraid, need to make sure no access
to previously freed nodes happens when doing full depsgraph destroy.

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

M	source/blender/depsgraph/intern/depsgraph.cpp

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

diff --git a/source/blender/depsgraph/intern/depsgraph.cpp b/source/blender/depsgraph/intern/depsgraph.cpp
index 2fda708..6cd6a64 100644
--- a/source/blender/depsgraph/intern/depsgraph.cpp
+++ b/source/blender/depsgraph/intern/depsgraph.cpp
@@ -50,11 +50,11 @@ Depsgraph::Depsgraph()
 Depsgraph::~Depsgraph()
 {
 	/* Free root node - it won't have been freed yet... */
-	if (this->root_node) {
-		OBJECT_GUARDED_DELETE(this->root_node, RootDepsNode);
-	}
 	clear_id_nodes();
 	clear_subgraph_nodes();
+	if (this->root_node != NULL) {
+		OBJECT_GUARDED_DELETE(this->root_node, RootDepsNode);
+	}
 }
 
 /* Query Conditions from RNA ----------------------- */




More information about the Bf-blender-cvs mailing list