Depsgraph: Prevent non-expandable datablocks from being freed
authorSergey Sharybin <sergey.vfx@gmail.com>
Tue, 20 Mar 2018 14:13:54 +0000 (15:13 +0100)
committerSergey Sharybin <sergey.vfx@gmail.com>
Tue, 20 Mar 2018 15:07:27 +0000 (16:07 +0100)
This avoids original image datablock destruction when using
copy on write.

source/blender/depsgraph/intern/builder/deg_builder_nodes.cc

index e7a9b4b5a69767732e0d31cd6d4f8c444cf22d82..bbf28a98aa24ca0603b3164a7a04c62a3e5aad81 100644 (file)
@@ -374,6 +374,9 @@ void DepsgraphNodeBuilder::begin_build() {
                cow_id_hash_ = BLI_ghash_ptr_new("Depsgraph id hash");
                foreach (IDDepsNode *id_node, graph_->id_nodes) {
                        if (deg_copy_on_write_is_expanded(id_node->id_cow)) {
+                               if (id_node->id_orig == id_node->id_cow) {
+                                       continue;
+                               }
                                BLI_ghash_insert(cow_id_hash_,
                                                 id_node->id_orig,
                                                 id_node->id_cow);