Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrecht Van Lommel <brecht@blender.org>2021-06-22 19:17:48 +0300
committerBrecht Van Lommel <brecht@blender.org>2021-06-22 19:26:58 +0300
commit026de343e3528fe2b2f8d8daba7fa2fd4b807337 (patch)
treeb327e0615c9530b8fd62d59a8fe3882079fadf2a /source/blender/blenkernel/intern/mesh_runtime.c
parentf8d219dfd4c31a918e33cb715472d91a5cd3fd51 (diff)
Fix deadlock with shrinkwrap and other modifiers
More code that needs task isolation. Encountered in sprite fright production file. Ref D11603
Diffstat (limited to 'source/blender/blenkernel/intern/mesh_runtime.c')
-rw-r--r--source/blender/blenkernel/intern/mesh_runtime.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/source/blender/blenkernel/intern/mesh_runtime.c b/source/blender/blenkernel/intern/mesh_runtime.c
index fae4c87626a..011dd7e25ee 100644
--- a/source/blender/blenkernel/intern/mesh_runtime.c
+++ b/source/blender/blenkernel/intern/mesh_runtime.c
@@ -30,6 +30,7 @@
#include "DNA_object_types.h"
#include "BLI_math_geom.h"
+#include "BLI_task.h"
#include "BLI_threads.h"
#include "BKE_bvhutils.h"
@@ -151,6 +152,12 @@ int BKE_mesh_runtime_looptri_len(const Mesh *mesh)
return looptri_len;
}
+static void mesh_runtime_looptri_recalc_isolated(void *userdata)
+{
+ Mesh *mesh = userdata;
+ BKE_mesh_runtime_looptri_recalc(mesh);
+}
+
/* This is a ported copy of dm_getLoopTriArray(dm). */
const MLoopTri *BKE_mesh_runtime_looptri_ensure(Mesh *mesh)
{
@@ -163,7 +170,8 @@ const MLoopTri *BKE_mesh_runtime_looptri_ensure(Mesh *mesh)
BLI_assert(BKE_mesh_runtime_looptri_len(mesh) == mesh->runtime.looptris.len);
}
else {
- BKE_mesh_runtime_looptri_recalc(mesh);
+ /* Must isolate multithreaded tasks while holding a mutex lock. */
+ BLI_task_isolate(mesh_runtime_looptri_recalc_isolated, mesh);
looptri = mesh->runtime.looptris.array;
}