[Bf-blender-cvs] [205d1876ff5] blender2.8: DRW: Fix crash with deferred compilation

Clément Foucault noreply at git.blender.org
Mon Nov 5 16:31:20 CET 2018


Commit: 205d1876ff53ed890b79814d412e0d59927359b2
Author: Clément Foucault
Date:   Sun Nov 4 20:01:58 2018 +0100
Branches: blender2.8
https://developer.blender.org/rB205d1876ff53ed890b79814d412e0d59927359b2

DRW: Fix crash with deferred compilation

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

M	source/blender/draw/intern/draw_manager_shader.c

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

diff --git a/source/blender/draw/intern/draw_manager_shader.c b/source/blender/draw/intern/draw_manager_shader.c
index 31a74885e23..bb580695865 100644
--- a/source/blender/draw/intern/draw_manager_shader.c
+++ b/source/blender/draw/intern/draw_manager_shader.c
@@ -134,7 +134,10 @@ static void drw_deferred_shader_compilation_exec(void *custom_data, short *stop,
 		glFlush();
 		BLI_mutex_unlock(&comp->compilation_lock);
 
+		BLI_spin_lock(&comp->list_lock);
 		drw_deferred_shader_free(comp->mat_compiling);
+		comp->mat_compiling = NULL;
+		BLI_spin_unlock(&comp->list_lock);
 	}
 
 	WM_opengl_context_release(gl_context);
@@ -239,12 +242,11 @@ void DRW_deferred_shader_remove(GPUMaterial *mat)
 				}
 
 				/* Wait for compilation to finish */
-				if (comp->mat_compiling != NULL) {
-					if (comp->mat_compiling->mat == mat) {
-						BLI_mutex_lock(&comp->compilation_lock);
-						BLI_mutex_unlock(&comp->compilation_lock);
-					}
+				if ((comp->mat_compiling != NULL) && (comp->mat_compiling->mat == mat)) {
+					BLI_mutex_lock(&comp->compilation_lock);
+					BLI_mutex_unlock(&comp->compilation_lock);
 				}
+
 				BLI_spin_unlock(&comp->list_lock);
 
 				if (dsh) {



More information about the Bf-blender-cvs mailing list