diff options
author | Campbell Barton <ideasman42@gmail.com> | 2021-09-02 08:39:52 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2021-09-02 09:12:24 +0300 |
commit | a8739ae6c2acbf0737113fbebf7e5ac0a942aaee (patch) | |
tree | 8ffccedde5a807780d0d3e988953aa75ceffa43d /source/blender/blenkernel/intern/mesh_wrapper.c | |
parent | a2f3aca6470b9a7f211ff95c5f3efeb7f62cb9f4 (diff) |
Fix regression in recent change 0708733c46cb6b50697c1b80a6541d6fb410267e
Adding a mirror modifier in edit-mode crashed.
Freeing meshes that hold a shallow copy happens in multiple places
while calculating modifiers, making it impractical to clear the
edit-mode pointer before freeing the mesh (as done in
BKE_editmesh_free_derived_caches).
Add a struct member to the edit-mesh struct so evaluated copies
don't free the edit-mesh contents.
Diffstat (limited to 'source/blender/blenkernel/intern/mesh_wrapper.c')
-rw-r--r-- | source/blender/blenkernel/intern/mesh_wrapper.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/source/blender/blenkernel/intern/mesh_wrapper.c b/source/blender/blenkernel/intern/mesh_wrapper.c index de7259757bf..bc1ffeb8cf4 100644 --- a/source/blender/blenkernel/intern/mesh_wrapper.c +++ b/source/blender/blenkernel/intern/mesh_wrapper.c @@ -69,7 +69,9 @@ Mesh *BKE_mesh_wrapper_from_editmesh_with_coords(BMEditMesh *em, /* Use edit-mesh directly where possible. */ me->runtime.is_original = true; - me->edit_mesh = em; + + me->edit_mesh = MEM_dupallocN(em); + me->edit_mesh->is_shallow_copy = true; /* Make sure, we crash if these are ever used. */ #ifdef DEBUG |