[Bf-blender-cvs] [201689daeb3] soc-2017-normal-tools: Remove support of lnorspacearray in editmesh undo/redo, fix memleak.
Bastien Montagne
noreply at git.blender.org
Mon Jun 12 09:35:49 CEST 2017
Commit: 201689daeb30448f0fa25d3561961b9a33bbf9a6
Author: Bastien Montagne
Date: Mon Jun 12 09:32:15 2017 +0200
Branches: soc-2017-normal-tools
https://developer.blender.org/rB201689daeb30448f0fa25d3561961b9a33bbf9a6
Remove support of lnorspacearray in editmesh undo/redo, fix memleak.
Supporting lnorspacearray in undo/redo would require a deep copy of lnor
spaces, not only a shallow copy of top struct. And it would eat a fair
amount of memory, think we'd rather recompute those on undo for now!
Also, fixed memory leaked by not correctly freeing lnorspace array on
BMesh deletion.
===================================================================
M source/blender/bmesh/intern/bmesh_mesh.c
M source/blender/editors/mesh/editmesh_undo.c
===================================================================
diff --git a/source/blender/bmesh/intern/bmesh_mesh.c b/source/blender/bmesh/intern/bmesh_mesh.c
index 6e2b65245c8..7745438fceb 100644
--- a/source/blender/bmesh/intern/bmesh_mesh.c
+++ b/source/blender/bmesh/intern/bmesh_mesh.c
@@ -270,7 +270,10 @@ void BM_mesh_data_free(BMesh *bm)
BLI_freelistN(&bm->selected);
- MEM_SAFE_FREE(bm->bmspacearr);
+ if (bm->bmspacearr) {
+ BKE_lnor_spacearr_free(bm->bmspacearr);
+ MEM_freeN(bm->bmspacearr);
+ }
BMO_error_clear(bm);
}
diff --git a/source/blender/editors/mesh/editmesh_undo.c b/source/blender/editors/mesh/editmesh_undo.c
index 953b4c1b0f5..82d6bea6c1c 100644
--- a/source/blender/editors/mesh/editmesh_undo.c
+++ b/source/blender/editors/mesh/editmesh_undo.c
@@ -86,8 +86,6 @@ typedef struct UndoMesh {
* There are a few ways this could be made to work but for now its a known limitation with mixing
* object and editmode operations - Campbell */
int shapenr;
- MLoopNorSpaceArray bmspacearr;
- char spacearr_dirty;
#ifdef USE_ARRAY_STORE
/* NULL arrays are considered empty */
@@ -491,9 +489,6 @@ static void *editbtMesh_to_undoMesh(void *emv, void *obdata)
UndoMesh *um = MEM_callocN(sizeof(UndoMesh), "undo Mesh");
- um->bmspacearr = *em->bm->bmspacearr;
- um->spacearr_dirty = em->bm->spacearr_dirty;
-
/* make sure shape keys work */
um->me.key = obme->key ? BKE_key_copy_nolib(obme->key) : NULL;
@@ -586,8 +581,7 @@ static void undoMesh_to_editbtMesh(void *um_v, void *em_v, void *obdata)
bm->selectmode = um->selectmode;
em->ob = ob;
- *bm->bmspacearr = um->bmspacearr;
- bm->spacearr_dirty = um->spacearr_dirty;
+ bm->spacearr_dirty = BM_SPACEARR_DIRTY_ALL;
/* T35170: Restore the active key on the RealMesh. Otherwise 'fake' offset propagation happens
* if the active is a basis for any other. */
More information about the Bf-blender-cvs
mailing list