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>2015-11-25 18:01:08 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2015-11-25 18:14:01 +0300
commit1bec2aa54e85f4b7aceab98aee705516e4a96e1c (patch)
treea88e362d48e81d064d9fa4f80b7a324021c559e3 /intern/cycles/render/graph.cpp
parent485ea4353f293317ce395a75663758092cb6f969 (diff)
Cycles: Fix crash in constant folding introduced by recent commit
Graph::disconnect() actually modifies links, needs to create a copy to iterate if disconnect happens form inside the loop. Question tho whether we can control this somehow.. Reported by BzztPloink in IRC, thanks!
Diffstat (limited to 'intern/cycles/render/graph.cpp')
-rw-r--r--intern/cycles/render/graph.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/intern/cycles/render/graph.cpp b/intern/cycles/render/graph.cpp
index 8468690841d..2977555b410 100644
--- a/intern/cycles/render/graph.cpp
+++ b/intern/cycles/render/graph.cpp
@@ -582,12 +582,13 @@ void ShaderGraph::constant_fold(set<ShaderNode*>& done, ShaderNode *node)
}
/* Then fold self. */
- foreach(ShaderOutput *sock, node->outputs) {
+ foreach(ShaderOutput *output, node->outputs) {
float3 optimized_value = make_float3(0.0f, 0.0f, 0.0f);
- if(node->constant_fold(sock, &optimized_value)) {
- /* Apply optimized value to connected sockets */
- foreach(ShaderInput *in, sock->links) {
+ if(node->constant_fold(output, &optimized_value)) {
+ /* Apply optimized value to connected sockets. */
+ vector<ShaderInput*> links(output->links);
+ foreach(ShaderInput *in, links) {
in->value = optimized_value;
disconnect(in);
}