diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2018-11-04 22:01:58 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2018-11-05 18:31:12 +0300 |
commit | 205d1876ff53ed890b79814d412e0d59927359b2 (patch) | |
tree | 23f90074ee5f8be95ba1c7f7c5ef83d72dcd7484 /source/blender/draw/intern | |
parent | 050e91340da1b4d263b850bbe4e114379c2188cb (diff) |
DRW: Fix crash with deferred compilation
Diffstat (limited to 'source/blender/draw/intern')
-rw-r--r-- | source/blender/draw/intern/draw_manager_shader.c | 12 |
1 files changed, 7 insertions, 5 deletions
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) { |