[Bf-blender-cvs] [a5c89574a3f] master: Fix Cycles assert on exit after recent changes

Brecht Van Lommel noreply at git.blender.org
Fri May 3 18:33:52 CEST 2019


Commit: a5c89574a3f7e915dd3fe44a73f7f184ce1758e2
Author: Brecht Van Lommel
Date:   Fri May 3 17:42:08 2019 +0200
Branches: master
https://developer.blender.org/rBa5c89574a3f7e915dd3fe44a73f7f184ce1758e2

Fix Cycles assert on exit after recent changes

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

M	intern/cycles/device/device_cpu.cpp
M	intern/cycles/util/util_aligned_malloc.h

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

diff --git a/intern/cycles/device/device_cpu.cpp b/intern/cycles/device/device_cpu.cpp
index 32911e054fe..5d279ebb965 100644
--- a/intern/cycles/device/device_cpu.cpp
+++ b/intern/cycles/device/device_cpu.cpp
@@ -321,7 +321,7 @@ class CPUDevice : public Device {
   ~CPUDevice()
   {
 #ifdef WITH_OSL
-    delete osl_globals;
+    util_aligned_delete(osl_globals);
 #endif
     task_pool.stop();
     texture_info.free();
diff --git a/intern/cycles/util/util_aligned_malloc.h b/intern/cycles/util/util_aligned_malloc.h
index a76884b20a5..7115e4cb0c6 100644
--- a/intern/cycles/util/util_aligned_malloc.h
+++ b/intern/cycles/util/util_aligned_malloc.h
@@ -37,6 +37,14 @@ template<typename T> T *util_aligned_new()
   return new (mem) T();
 }
 
+template<typename T> void util_aligned_delete(T *t)
+{
+  if (t) {
+    t->~T();
+    util_aligned_free(t);
+  }
+}
+
 CCL_NAMESPACE_END
 
 #endif /* __UTIL_ALIGNED_MALLOC_H__ */



More information about the Bf-blender-cvs mailing list