From 03f5e1362d0cf1cc8c4edbd6e0e7bfd5ee8705a0 Mon Sep 17 00:00:00 2001 From: Nicolas Roussel Date: Wed, 5 Jun 2024 15:32:18 +0200 Subject: [PATCH] Avoid segfaults during `Scene` shutdown The JIT might have shutdown before the `static_accel_shutdown_gpu` is executed. --- src/render/scene_optix.inl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/render/scene_optix.inl b/src/render/scene_optix.inl index 0706da692..3cea00f69 100644 --- a/src/render/scene_optix.inl +++ b/src/render/scene_optix.inl @@ -580,7 +580,8 @@ MI_VARIANT void Scene::static_accel_shutdown_gpu() { /* Decrease the reference count of the pipeline JIT variable. This will trigger the release of the OptiX pipeline data structure if no ray tracing calls are pending. */ - (void) UInt32::steal(config.pipeline_jit_index); + if (jit_has_backend(JitBackend::CUDA)) + (void) UInt32::steal(config.pipeline_jit_index); for (size_t i = 0; i < 2 * OPTIX_SHAPE_TYPE_COUNT; i++) free(config.custom_shapes_program_names[i]);