diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2017-11-24 17:13:45 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2017-11-24 17:46:25 +0300 |
commit | 3023eb384a679012543dc08a860a2c9862887b17 (patch) | |
tree | 99283ad1c0069b7d6492b9c0069860f98907e43e /source | |
parent | 71febcbae04a24b63356740f0f8150c2cf5eb57f (diff) |
Depsgraph: Fix crash when deleting object which is linked both directly and indirectly
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/depsgraph/DEG_depsgraph.h | 1 | ||||
-rw-r--r-- | source/blender/depsgraph/intern/depsgraph_tag.cc | 18 | ||||
-rw-r--r-- | source/blender/editors/object/object_add.c | 3 |
3 files changed, 21 insertions, 1 deletions
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) |