Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2018-01-24 13:46:54 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2018-01-24 13:46:54 +0300
commit752fc35fa15b6bfee0309354ffcbf5c78211e8a6 (patch)
tree66ec596a17c9bd4e57a48d9fd6c6e5b67dd506b6 /source
parentfe18d9ba11efa32f9c6a9122c3422ec38ebada76 (diff)
Depsgraph: Fix crash entering edit mode with CoW enabled
The issue was caused by some incompatibility of new API which expects ID block to be specified explicitly, while old code is tagging object's data using object's ID with OB_RECALC_DATA flag. We need to switch all areas to give proper ID and everything, but for until then we'd better stop crashing.
Diffstat (limited to 'source')
-rw-r--r--source/blender/depsgraph/intern/depsgraph_tag.cc61
1 files changed, 47 insertions, 14 deletions
diff --git a/source/blender/depsgraph/intern/depsgraph_tag.cc b/source/blender/depsgraph/intern/depsgraph_tag.cc
index e7c13083343..f63a4c90427 100644
--- a/source/blender/depsgraph/intern/depsgraph_tag.cc
+++ b/source/blender/depsgraph/intern/depsgraph_tag.cc
@@ -262,6 +262,47 @@ void depsgraph_update_editors_tag(Main *bmain, Depsgraph *graph, ID *id)
deg_editors_id_update(&update_ctx, id);
}
+void depsgraph_tag_component(Depsgraph *graph,
+ IDDepsNode *id_node,
+ eDepsNode_Type component_type,
+ eDepsOperation_Code operation_code)
+{
+ ComponentDepsNode *component_node =
+ id_node->find_component(component_type);
+ if (component_node == NULL) {
+ return;
+ }
+ if (operation_code == DEG_OPCODE_OPERATION) {
+ component_node->tag_update(graph);
+ }
+ else {
+ OperationDepsNode *operation_node =
+ component_node->find_operation(operation_code);
+ if (operation_node != NULL) {
+ operation_node->tag_update(graph);
+ }
+ }
+}
+
+/* This is a tag compatibility with legacy code.
+ *
+ * Mainly, old code was tagging object with OB_RECALC_DATA tag to inform
+ * that object's data datablock changed. Now API expects that ID is given
+ * explicitly, but not all areas are aware of this yet.
+ */
+void deg_graph_id_tag_legacy_compat(Main *bmain,
+ ID *id,
+ eDepsgraph_Tag tag)
+{
+ if (tag == DEG_TAG_GEOMETRY && GS(id->name) == ID_OB) {
+ Object *object = (Object *)id;
+ ID *data_id = (ID *)object->data;
+ if (data_id != NULL) {
+ DEG_id_tag_update_ex(bmain, data_id, 0);
+ }
+ }
+}
+
void deg_graph_id_tag_update_single_flag(Main *bmain,
Depsgraph *graph,
ID *id,
@@ -303,21 +344,13 @@ void deg_graph_id_tag_update_single_flag(Main *bmain,
id_node->tag_update(graph);
}
else {
- ComponentDepsNode *component_node =
- id_node->find_component(component_type);
- if (component_node != NULL) {
- if (operation_code == DEG_OPCODE_OPERATION) {
- component_node->tag_update(graph);
- }
- else {
- OperationDepsNode *operation_node =
- component_node->find_operation(operation_code);
- if (operation_node != NULL) {
- operation_node->tag_update(graph);
- }
- }
- }
+ depsgraph_tag_component(graph, id_node, component_type, operation_code);
}
+ /* TODO(sergey): Get rid of this once all areas are using proper data ID
+ * for tagging.
+ */
+ deg_graph_id_tag_legacy_compat(bmain, id, tag);
+
}
void deg_graph_id_tag_update(Main *bmain, Depsgraph *graph, ID *id, int flag)