From 21668359b79bd4a44a1f34e479a7bd8072ecdc69 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Wed, 3 Jul 2019 15:15:11 +0200 Subject: Fix T66234: Issue on switching material mode between Object and Data The root of the issue comes to the fact that part of dependency graph is being removed, without doing any further remapping. This was happening because only materials used by objects were pulled in, so when material mode is changed some material became unused and removed from the dependency graph and freed, causing object or its data to point to a freed memory in its materials array. Simplest and safest way to solve this is to pull materials referenced by both object and object data. This causes somewhat higher memory usage but keeps evaluated state of scene in an always consistent state, without any need to tag/update object's data on material mode change. Don't think it is a problem in practice. Reviewers: brecht, fclem Reviewed By: brecht, fclem Differential Revision: https://developer.blender.org/D5172 --- source/blender/depsgraph/intern/builder/deg_builder_nodes.h | 1 + 1 file changed, 1 insertion(+) (limited to 'source/blender/depsgraph/intern/builder/deg_builder_nodes.h') diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes.h b/source/blender/depsgraph/intern/builder/deg_builder_nodes.h index 9983b346355..de9f0e4d6cd 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_nodes.h +++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes.h @@ -202,6 +202,7 @@ class DepsgraphNodeBuilder : public DepsgraphBuilder { void build_light(Light *lamp); void build_nodetree(bNodeTree *ntree); void build_material(Material *ma); + void build_materials(Material **materials, int num_materials); void build_texture(Tex *tex); void build_image(Image *image); void build_world(World *world); -- cgit v1.2.3