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
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2020-03-11 19:25:17 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2020-03-11 19:38:42 +0300
commite9220d5cd013340bde288c85b5125028c1400499 (patch)
tree457f7efd7600d4b61bf4639ff0e18349edd9c58b /source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc
parent19b46b2fca790f00c7da79ecbcf219e772874a2c (diff)
Depsgraph: Fix crash deleting Viewer image from Outliner
Was happening when having compositor open with Viewer node attached directly to Render Layers output. There were two things involved here: 1. The code which was storing CoW-ed versions of IDs was checking all IDs for whether they are expanded or not. This was causing access of freed memory for deleted IDs which do not need CoW (such as IM). Simple fix: store ID type as a scalar and use early check before doing more elaborate check based on accessing fields of id_cow. 2. The code which was ensuring view layer pointer is doing CoW for scene. This isn't an issue on its own, but scene might have an embedded ID such as compositor which was actually traversed by the ID remap routines. This was causing remapping procedure to go into non-updated copy of compositor, accessing freed Viewer image ID. Solved by not recursing into embedded IDs for datablocks as those are supposed to have own copy-on-write operations which takes care of re-mapping. Reported my Bastien, and also pair-coded with him.
Diffstat (limited to 'source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc')
-rw-r--r--source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc12
1 files changed, 10 insertions, 2 deletions
diff --git a/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc b/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc
index 50870d1e4aa..d8ce590c611 100644
--- a/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc
+++ b/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc
@@ -914,8 +914,11 @@ ID *deg_expand_copy_on_write_datablock(const Depsgraph *depsgraph,
user_data.depsgraph = depsgraph;
user_data.node_builder = node_builder;
user_data.create_placeholders = create_placeholders;
- BKE_library_foreach_ID_link(
- nullptr, id_cow, foreach_libblock_remap_callback, (void *)&user_data, IDWALK_NOP);
+ BKE_library_foreach_ID_link(nullptr,
+ id_cow,
+ foreach_libblock_remap_callback,
+ (void *)&user_data,
+ IDWALK_IGNORE_EMBEDDED_ID);
/* Correct or tweak some pointers which are not taken care by foreach
* from above. */
update_id_after_copy(depsgraph, id_node, id_orig, id_cow);
@@ -1113,6 +1116,11 @@ bool deg_copy_on_write_is_expanded(const ID *id_cow)
bool deg_copy_on_write_is_needed(const ID *id_orig)
{
const ID_Type id_type = GS(id_orig->name);
+ return deg_copy_on_write_is_needed(id_type);
+}
+
+bool deg_copy_on_write_is_needed(const ID_Type id_type)
+{
return ID_TYPE_IS_COW(id_type);
}