From 424901ad7b32a9bc4be5b5e4f062b98e83ebfde0 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Wed, 5 Apr 2017 14:21:49 +0200 Subject: [PATCH] Cycles: Guard global write access in SVM compilation code --- intern/cycles/render/svm.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/intern/cycles/render/svm.cpp b/intern/cycles/render/svm.cpp index 4cb4018e2b4..48287d872d4 100644 --- a/intern/cycles/render/svm.cpp +++ b/intern/cycles/render/svm.cpp @@ -67,6 +67,7 @@ void SVMShaderManager::device_update_shader(Scene *scene, << "Shader name: " << shader->name << "\n" << summary.full_report(); + nodes_lock_.lock(); if(shader->use_mis && shader->has_surface_emission) { scene->light_manager->need_update = true; } @@ -74,7 +75,6 @@ void SVMShaderManager::device_update_shader(Scene *scene, /* The copy needs to be done inside the lock, if another thread resizes the array * while memcpy is running, it'll be copying into possibly invalid/freed ram. */ - nodes_lock_.lock(); size_t global_nodes_size = global_svm_nodes->size(); global_svm_nodes->resize(global_nodes_size + svm_nodes.size());