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:
authorCampbell Barton <ideasman42@gmail.com>2021-09-02 08:29:36 +0300
committerCampbell Barton <ideasman42@gmail.com>2021-09-02 08:30:54 +0300
commit19e1b5c1fd61b622382c2cf7d782e99f6cb8c64b (patch)
tree21308e2479e1c75eb8efb915bf169f215b381cff
parent0708733c46cb6b50697c1b80a6541d6fb410267e (diff)
Fix T90972: Crash calling Mesh.clear_geometry in edit-mode
No longer free the edit-mesh pointer while in edit-mode since this isn't reliable to keep the object in edit-mode while freeing it's edit-mesh data. Users who want to exit edit-mode should do so explicitly. Caused by 6d2f9b1dfa98502e9e9f1a73e3dded2ded1f1ce6.
-rw-r--r--source/blender/blenkernel/intern/mesh.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/source/blender/blenkernel/intern/mesh.c b/source/blender/blenkernel/intern/mesh.c
index daff82802f9..6814083817c 100644
--- a/source/blender/blenkernel/intern/mesh.c
+++ b/source/blender/blenkernel/intern/mesh.c
@@ -886,6 +886,18 @@ void BKE_mesh_free_data_for_undo(Mesh *me)
mesh_free_data(&me->id);
}
+/**
+ * \note on data that this function intentionally doesn't free:
+ *
+ * - Materials and shape keys are not freed here (#Mesh.mat & #Mesh.key).
+ * As freeing shape keys requires tagging the depsgraph for updated relations,
+ * which is expensive.
+ * Material slots should be kept in sync with the object.
+ *
+ * - Edit-Mesh (#Mesh.edit_mesh)
+ * Since edit-mesh is tied to the objects mode,
+ * which crashes when called in edit-mode, see: T90972.
+ */
static void mesh_clear_geometry(Mesh *mesh)
{
CustomData_free(&mesh->vdata, mesh->totvert);
@@ -895,11 +907,6 @@ static void mesh_clear_geometry(Mesh *mesh)
CustomData_free(&mesh->pdata, mesh->totpoly);
MEM_SAFE_FREE(mesh->mselect);
- MEM_SAFE_FREE(mesh->edit_mesh);
-
- /* Note that materials and shape keys are not freed here. This is intentional, as freeing
- * shape keys requires tagging the depsgraph for updated relations, which is expensive.
- * Material slots should be kept in sync with the object. */
mesh->totvert = 0;
mesh->totedge = 0;