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:
authorSergey Sharybin <sergey@blender.org>2022-02-24 16:15:38 +0300
committerSergey Sharybin <sergey@blender.org>2022-03-01 13:46:38 +0300
commit629f22f161abfbe492d71e08cc89651da683aded (patch)
tree544d7f14878fc7ff2b2ea223bd39475c3230b6df
parentcde5e12c0bcc55b7c19b625ebf7a6f29dbd833d7 (diff)
Fix T95997: Crash when entering edit mode
The issue was uncovered by the 0f89bcdbebf5, but the root cause goes into a much earlier design violation happened in the code: the modifier evaluation function is modifying input mesh, which is not something what is ever expected. Bring code closer to the older state where such modification is only done for the object in edit mode. --- From own tests works seems to work fine, but extra eyes and testing is needed. Differential Revision: https://developer.blender.org/D14191
-rw-r--r--source/blender/blenkernel/intern/DerivedMesh.cc4
1 files changed, 3 insertions, 1 deletions
diff --git a/source/blender/blenkernel/intern/DerivedMesh.cc b/source/blender/blenkernel/intern/DerivedMesh.cc
index 1fcf1bf1839..00a6fa6d178 100644
--- a/source/blender/blenkernel/intern/DerivedMesh.cc
+++ b/source/blender/blenkernel/intern/DerivedMesh.cc
@@ -1667,7 +1667,9 @@ static void editbmesh_calc_modifiers(struct Depsgraph *depsgraph,
}
else {
Mesh *me_orig = mesh_input;
- if (me_orig->id.tag & LIB_TAG_COPIED_ON_WRITE) {
+ /* Modifying the input mesh is weak, however as there can only be one object in edit mode
+ * even if multiple are sharing the same mesh this should be thread safe. */
+ if ((me_orig->id.tag & LIB_TAG_COPIED_ON_WRITE) && (ob->mode & OB_MODE_EDIT)) {
if (!BKE_mesh_runtime_ensure_edit_data(me_orig)) {
BKE_mesh_runtime_reset_edit_data(me_orig);
}