[Bf-blender-cvs] [3023eb384a6] blender2.8: Depsgraph: Fix crash when deleting object which is linked both directly and indirectly

Sergey Sharybin noreply at git.blender.org
Fri Nov 24 17:10:29 CET 2017


Commit: 3023eb384a679012543dc08a860a2c9862887b17
Author: Sergey Sharybin
Date:   Fri Nov 24 15:13:45 2017 +0100
Branches: blender2.8
https://developer.blender.org/rB3023eb384a679012543dc08a860a2c9862887b17

Depsgraph: Fix crash when deleting object which is linked both directly and indirectly

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

M	source/blender/depsgraph/DEG_depsgraph.h
M	source/blender/depsgraph/intern/depsgraph_tag.cc
M	source/blender/editors/object/object_add.c

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

diff --git a/source/blender/depsgraph/DEG_depsgraph.h b/source/blender/depsgraph/DEG_depsgraph.h
index f007ceeed9e..7b1f1fc8ca9 100644
--- a/source/blender/depsgraph/DEG_depsgraph.h
+++ b/source/blender/depsgraph/DEG_depsgraph.h
@@ -166,6 +166,7 @@ enum {
 	 */
 	DEG_TAG_SHADING_UPDATE  = (1 << 9),
 	DEG_TAG_SELECT_UPDATE   = (1 << 10),
+	DEG_TAG_BASE_FLAGS_UPDATE = (1 << 11),
 };
 void DEG_id_tag_update(struct ID *id, int flag);
 void DEG_id_tag_update_ex(struct Main *bmain, struct ID *id, int flag);
diff --git a/source/blender/depsgraph/intern/depsgraph_tag.cc b/source/blender/depsgraph/intern/depsgraph_tag.cc
index 82bc74fa56f..d13f40af1bc 100644
--- a/source/blender/depsgraph/intern/depsgraph_tag.cc
+++ b/source/blender/depsgraph/intern/depsgraph_tag.cc
@@ -326,6 +326,21 @@ void id_tag_update_select_update(Depsgraph *graph, IDDepsNode *id_node)
 	}
 }
 
+void id_tag_update_base_flags(Depsgraph *graph, IDDepsNode *id_node)
+{
+	ComponentDepsNode *component =
+	        id_node->find_component(DEG_NODE_TYPE_LAYER_COLLECTIONS);
+	if (component == NULL) {
+		return;
+	}
+	OperationDepsNode *node =
+	        component->find_operation(DEG_OPCODE_OBJECT_BASE_FLAGS);
+	if (node == NULL) {
+		return;
+	}
+	node->tag_update(graph);
+}
+
 void id_tag_update_ntree_special(Main *bmain, Depsgraph *graph, ID *id, int flag)
 {
 	bNodeTree *ntree = NULL;
@@ -392,6 +407,9 @@ void deg_graph_id_tag_update(Main *bmain, Depsgraph *graph, ID *id, int flag)
 	if (flag & DEG_TAG_SELECT_UPDATE) {
 		id_tag_update_select_update(graph, id_node);
 	}
+	if (flag & DEG_TAG_BASE_FLAGS_UPDATE) {
+		id_tag_update_base_flags(graph, id_node);
+	}
 	id_tag_update_ntree_special(bmain, graph, id, flag);
 }
 
diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c
index dfb001bfe14..77b30951dee 100644
--- a/source/blender/editors/object/object_add.c
+++ b/source/blender/editors/object/object_add.c
@@ -1215,9 +1215,10 @@ void ED_object_base_free_and_unlink(Main *bmain, Scene *scene, Object *ob)
 		return;
 	}
 
+	DEG_id_tag_update_ex(bmain, &ob->id, DEG_TAG_BASE_FLAGS_UPDATE);
+
 	object_delete_check_glsl_update(ob);
 	BKE_collections_object_remove(bmain, scene, ob, true);
-	DEG_id_type_tag(bmain, ID_OB);
 }
 
 static int object_delete_exec(bContext *C, wmOperator *op)



More information about the Bf-blender-cvs mailing list