Fix T60434: crash with OSL and viewport + preview render at the same time.

Don't free LLVM JIT memory until process exit, there might be multiple OSL
instances using it.
This commit is contained in:
Brecht Van Lommel 2019-03-13 18:26:11 +01:00
parent 6a8d87db18
commit 1be16466e7
3 changed files with 10 additions and 0 deletions

@ -66,6 +66,10 @@ OSLShaderManager::~OSLShaderManager()
{
shading_system_free();
texture_system_free();
}
void OSLShaderManager::free_memory()
{
#ifdef OSL_HAS_BLENDER_CLEANUP_FIX
/* There is a problem with llvm+osl: The order global destructors across
* different compilation units run cannot be guaranteed, on windows this means

@ -70,6 +70,8 @@ public:
OSLShaderManager();
~OSLShaderManager();
static void free_memory();
void reset(Scene *scene);
bool use_osl() { return true; }

@ -692,6 +692,10 @@ void ShaderManager::get_requested_features(Scene *scene,
void ShaderManager::free_memory()
{
beckmann_table.free_memory();
#ifdef WITH_OSL
OSLShaderManager::free_memory();
#endif
}
float ShaderManager::linear_rgb_to_gray(float3 c)