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:
authorAlexander Gavrilov <angavrilov@gmail.com>2018-12-03 15:22:19 +0300
committerAlexander Gavrilov <angavrilov@gmail.com>2018-12-03 17:01:02 +0300
commit1983a52e04eb0b0a8a71d66a1bb2f316f1326d90 (patch)
tree032e4d5d6909af1c21a7fc7abdb2b67911a32412 /source/blender/blenkernel/intern/DerivedMesh.c
parent764e937d1a77b99d384a729700a08ef6fbe7bfac (diff)
Depsgraph: assert that mesh_get_eval_final/deform aren't used in eval.
Using those functions during multithreaded evaluation is a sure way to have a race condition and crash.
Diffstat (limited to 'source/blender/blenkernel/intern/DerivedMesh.c')
-rw-r--r--source/blender/blenkernel/intern/DerivedMesh.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c
index b2586d513d6..f0097c46a71 100644
--- a/source/blender/blenkernel/intern/DerivedMesh.c
+++ b/source/blender/blenkernel/intern/DerivedMesh.c
@@ -2157,6 +2157,13 @@ DerivedMesh *mesh_get_derived_final(
Mesh *mesh_get_eval_final(
struct Depsgraph *depsgraph, Scene *scene, Object *ob, CustomDataMask dataMask)
{
+ /* This function isn't thread-safe and can't be used during evaluation. */
+ BLI_assert(DEG_debug_is_evaluating(depsgraph) == false);
+
+ /* Evaluated meshes aren't supposed to be created on original instances. If you do,
+ * they aren't cleaned up properly on mode switch, causing crashes, e.g T58150. */
+ BLI_assert(ob->id.tag & LIB_TAG_COPIED_ON_WRITE);
+
/* if there's no evaluated mesh or the last data mask used doesn't include
* the data we need, rebuild the derived mesh
*/
@@ -2197,6 +2204,13 @@ DerivedMesh *mesh_get_derived_deform(struct Depsgraph *depsgraph, Scene *scene,
#endif
Mesh *mesh_get_eval_deform(struct Depsgraph *depsgraph, Scene *scene, Object *ob, CustomDataMask dataMask)
{
+ /* This function isn't thread-safe and can't be used during evaluation. */
+ BLI_assert(DEG_debug_is_evaluating(depsgraph) == false);
+
+ /* Evaluated meshes aren't supposed to be created on original instances. If you do,
+ * they aren't cleaned up properly on mode switch, causing crashes, e.g T58150. */
+ BLI_assert(ob->id.tag & LIB_TAG_COPIED_ON_WRITE);
+
/* if there's no derived mesh or the last data mask used doesn't include
* the data we need, rebuild the derived mesh
*/