[Bf-blender-cvs] [70e16b3] master: Fix T47181: Blender OSL script node crash (OSL 1.6.9)

Lukas Stockner noreply at git.blender.org
Sat Jan 16 01:48:42 CET 2016


Commit: 70e16b3c99d3d81837c1b00bb1faaa143dc214ec
Author: Lukas Stockner
Date:   Sat Jan 16 01:32:22 2016 +0100
Branches: master
https://developer.blender.org/rB70e16b3c99d3d81837c1b00bb1faaa143dc214ec

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.

===================================================================

M	intern/cycles/render/osl.cpp

===================================================================

diff --git a/intern/cycles/render/osl.cpp b/intern/cycles/render/osl.cpp
index a75716e..75c993c 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;




More information about the Bf-blender-cvs mailing list