[Bf-blender-cvs] [d2f47017b98] master: Fix crash editing anisotropic filter preference from background mode

Brecht Van Lommel noreply at git.blender.org
Tue Jun 21 16:00:59 CEST 2022


Commit: d2f47017b984a50c2bf9ff355fb1d01865663d39
Author: Brecht Van Lommel
Date:   Tue Jun 21 15:41:36 2022 +0200
Branches: master
https://developer.blender.org/rBd2f47017b984a50c2bf9ff355fb1d01865663d39

Fix crash editing anisotropic filter preference from background mode

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

M	source/blender/gpu/intern/gpu_context.cc
M	source/blender/gpu/intern/gpu_texture.cc

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

diff --git a/source/blender/gpu/intern/gpu_context.cc b/source/blender/gpu/intern/gpu_context.cc
index c6eaf7defdc..b7dad589395 100644
--- a/source/blender/gpu/intern/gpu_context.cc
+++ b/source/blender/gpu/intern/gpu_context.cc
@@ -177,7 +177,7 @@ void GPU_render_step()
 /** \name Backend selection
  * \{ */
 
-static GPUBackend *g_backend;
+static GPUBackend *g_backend = nullptr;
 
 bool GPU_backend_supported(eGPUBackendType type)
 {
diff --git a/source/blender/gpu/intern/gpu_texture.cc b/source/blender/gpu/intern/gpu_texture.cc
index d78dc845074..c300c0da3b2 100644
--- a/source/blender/gpu/intern/gpu_texture.cc
+++ b/source/blender/gpu/intern/gpu_texture.cc
@@ -702,7 +702,11 @@ void GPU_texture_get_mipmap_size(GPUTexture *tex, int lvl, int *r_size)
 
 void GPU_samplers_update()
 {
-  GPUBackend::get()->samplers_update();
+  /* Backend may not exist when we are updating preferences from background mode. */
+  GPUBackend *backend = GPUBackend::get();
+  if (backend) {
+    backend->samplers_update();
+  }
 }
 
 /** \} */



More information about the Bf-blender-cvs mailing list