diff options
author | Campbell Barton <ideasman42@gmail.com> | 2021-09-02 08:29:34 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2021-09-02 08:30:54 +0300 |
commit | 0708733c46cb6b50697c1b80a6541d6fb410267e (patch) | |
tree | 2ddb2c60366efa656f0207e8463a09f2cfae6ad5 /source/blender/blenkernel/intern/mesh.c | |
parent | 809b33b69a04fc37e1535697b667158ca80f6d60 (diff) |
Fix T91123: Freeing meshes in edit-mode leaks memory
Freeing the edit-mesh pointer wasn't free the edit-mesh data it's self.
Unlinking from the outliner or through the Python API leaked memory.
This didn't often cause leaks in practice since ED_editors_exit
exits edit-mode for all objects.
Now freeing mesh data frees the edit-mode data as well,
this matches the behavior of other object types that support edit-mode.
Diffstat (limited to 'source/blender/blenkernel/intern/mesh.c')
-rw-r--r-- | source/blender/blenkernel/intern/mesh.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/mesh.c b/source/blender/blenkernel/intern/mesh.c index bfc05c2d624..daff82802f9 100644 --- a/source/blender/blenkernel/intern/mesh.c +++ b/source/blender/blenkernel/intern/mesh.c @@ -160,6 +160,12 @@ static void mesh_free_data(ID *id) BLI_freelistN(&mesh->vertex_group_names); + if (mesh->edit_mesh) { + BKE_editmesh_free_data(mesh->edit_mesh); + MEM_freeN(mesh->edit_mesh); + mesh->edit_mesh = NULL; + } + BKE_mesh_runtime_clear_cache(mesh); mesh_clear_geometry(mesh); MEM_SAFE_FREE(mesh->mat); |