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.
This commit is contained in:
parent
fe18d9ba11
commit
752fc35fa1
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue