[Bf-blender-cvs] [1001adb5001] master: Fix T81520: Crash setting the Cycles device from Python

Campbell Barton noreply at git.blender.org
Thu Oct 15 07:53:50 CEST 2020


Commit: 1001adb500196537050cc60e8d80318a2f1a56c3
Author: Campbell Barton
Date:   Thu Oct 15 16:51:18 2020 +1100
Branches: master
https://developer.blender.org/rB1001adb500196537050cc60e8d80318a2f1a56c3

Fix T81520: Crash setting the Cycles device from Python

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

M	intern/cycles/blender/addon/properties.py

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

diff --git a/intern/cycles/blender/addon/properties.py b/intern/cycles/blender/addon/properties.py
index 3eeaece7c36..054fd900419 100644
--- a/intern/cycles/blender/addon/properties.py
+++ b/intern/cycles/blender/addon/properties.py
@@ -1608,8 +1608,13 @@ class CyclesPreferences(bpy.types.AddonPreferences):
     # For backwards compatibility, only returns CUDA and OpenCL but still
     # refreshes all devices.
     def get_devices(self, compute_device_type=''):
+        import _cycles
+        # Ensure `self.devices` is not re-allocated when the second call to
+        # get_devices_for_type is made, freeing items from the first list.
+        for device_type in ('CUDA', 'OPTIX', 'OPENCL'):
+            self.update_device_entries(_cycles.available_devices(device_type))
+
         cuda_devices = self.get_devices_for_type('CUDA')
-        self.get_devices_for_type('OPTIX')
         opencl_devices = self.get_devices_for_type('OPENCL')
         return cuda_devices, opencl_devices



More information about the Bf-blender-cvs mailing list