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:
authorLukas Stockner <lukas.stockner@freenet.de>2016-01-16 03:32:22 +0300
committerLukas Stockner <lukas.stockner@freenet.de>2016-01-16 03:32:22 +0300
commit70e16b3c99d3d81837c1b00bb1faaa143dc214ec (patch)
treea1e430f474f8f607b50e54c89abf7c077e8d21ea
parent9a76354585e2cd2011267e79bd99ca59a06588f8 (diff)
Fix T47181: Blender OSL script node crash (OSL 1.6.9)
Compiling OSL scripts with errors in them would cause Blender to crash since the OSL version bump to 1.6.9 instead of printing the error to the console as it did before. With version 1.6.2, OSL added a pointer to an OpenImageIO ErrorHandler as an argument to the OSLCompiler constructor. However, since it defaults to the NULL pointer, Blender still compiled fine after the OSL version bump. It turns out, though, that this pointer is used without further checks inside the OSL code, which makes it crash when it tries to report an error unless a valid ErrorHandler pointer is specified. Therefore, this commit simply passes a pointer to the static default handler that OIIO offers, which prints the error to the console just like OSL did before. Using this feature for a more advanced error handling and displaying from the Blender side would be possible and seems reasonable, but for now it's not really relevant for fixing this bug.
-rw-r--r--intern/cycles/render/osl.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/intern/cycles/render/osl.cpp b/intern/cycles/render/osl.cpp
index a75716e9f68..75c993c1864 100644
--- a/intern/cycles/render/osl.cpp
+++ b/intern/cycles/render/osl.cpp
@@ -282,7 +282,7 @@ bool OSLShaderManager::osl_compile(const string& inputfile, const string& output
stdosl_path = path_get("shader/stdosl.h");
/* compile */
- OSL::OSLCompiler *compiler = new OSL::OSLCompiler();
+ OSL::OSLCompiler *compiler = new OSL::OSLCompiler(&OSL::ErrorHandler::default_handler());
bool ok = compiler->compile(string_view(inputfile), options, string_view(stdosl_path));
delete compiler;