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:
authorLukas Tönne <lukas.toenne@gmail.com>2014-01-30 16:06:48 +0400
committerLukas Tönne <lukas.toenne@gmail.com>2014-01-30 16:09:32 +0400
commit2b55d7895ced2c737e827e6a808634f730d275fc (patch)
tree093b89da72bde8905281b5259168ccea7bf29b14 /source/blender/modifiers/intern/MOD_laplaciansmooth.c
parent810c6d1880b9cb2944ab2bcb5eb60d8dedd97a64 (diff)
Fix T38403: Laplacian smooth on instanced objects leads to crash.
The laplacian modifiers (smooth and deform) use the OpenNL library, which is not threadsafe due to the use of a global context variable. Ideally this would be changed so that an explicit context can be created for every caller of the OpenNL functions, but since OpenNL's most recent version is from 2010 this is unlikely to happen. As a workaround for now just use a mutex to prevent conflicting OpenNL calls. Eventually OpenNL can be replaced by eigen or ceres.
Diffstat (limited to 'source/blender/modifiers/intern/MOD_laplaciansmooth.c')
-rw-r--r--source/blender/modifiers/intern/MOD_laplaciansmooth.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/source/blender/modifiers/intern/MOD_laplaciansmooth.c b/source/blender/modifiers/intern/MOD_laplaciansmooth.c
index febd81e2f1b..130013af75b 100644
--- a/source/blender/modifiers/intern/MOD_laplaciansmooth.c
+++ b/source/blender/modifiers/intern/MOD_laplaciansmooth.c
@@ -534,6 +534,11 @@ static void laplaciansmoothModifier_do(
sys->vert_centroid[1] = 0.0f;
sys->vert_centroid[2] = 0.0f;
memset_laplacian_system(sys, 0);
+
+#ifdef OPENNL_THREADING_HACK
+ modifier_opennl_lock();
+#endif
+
nlNewContext();
sys->context = nlGetCurrent();
nlSolverParameteri(NL_NB_VARIABLES, numVerts);
@@ -618,6 +623,11 @@ static void laplaciansmoothModifier_do(
}
nlDeleteContext(sys->context);
sys->context = NULL;
+
+#ifdef OPENNL_THREADING_HACK
+ modifier_opennl_unlock();
+#endif
+
delete_laplacian_system(sys);
}