diff options
author | Julian Eisel <julian@blender.org> | 2020-03-12 17:58:03 +0300 |
---|---|---|
committer | Julian Eisel <julian@blender.org> | 2020-03-12 17:58:03 +0300 |
commit | b86be9b2145458037fd0b17433b7af0efa7b6472 (patch) | |
tree | f333625555402992ebb35d258f93eda1130389e6 /source/blender/depsgraph/intern/builder/deg_builder_nodes.cc | |
parent | 00f83ec125207e90bf180b3eb7752d8cb6482a86 (diff) | |
parent | cb6cec904fa14ce0ab10a2a53af5c936d56376cf (diff) |
Merge branch 'temp-openxr-ghostxr' into temp-openxr-blenderside
Diffstat (limited to 'source/blender/depsgraph/intern/builder/deg_builder_nodes.cc')
-rw-r--r-- | source/blender/depsgraph/intern/builder/deg_builder_nodes.cc | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc index 01d84f6b5d8..c512300200e 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc @@ -319,6 +319,18 @@ void DepsgraphNodeBuilder::begin_build() * them for new ID nodes. */ id_info_hash_ = BLI_ghash_ptr_new("Depsgraph id hash"); for (IDNode *id_node : graph_->id_nodes) { + /* It is possible that the ID does not need to have CoW version in which case id_cow is the + * same as id_orig. Additionally, such ID might have been removed, which makes the check + * for whether id_cow is expanded to access freed memory. In orderr to deal with this we + * check whether CoW is needed based on a scalar value which does not lead to access of + * possibly deleted memory. + * Additionally, this saves some space in the map by skipping mapping for datablocks which + * do not need CoW, */ + if (!deg_copy_on_write_is_needed(id_node->id_type)) { + id_node->id_cow = nullptr; + continue; + } + IDInfo *id_info = (IDInfo *)MEM_mallocN(sizeof(IDInfo), "depsgraph id info"); if (deg_copy_on_write_is_expanded(id_node->id_cow) && id_node->id_orig != id_node->id_cow) { id_info->id_cow = id_node->id_cow; |