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
path: root/source
diff options
context:
space:
mode:
authorJoseph Eagar <joeedh@gmail.com>2011-05-12 22:33:10 +0400
committerJoseph Eagar <joeedh@gmail.com>2011-05-12 22:33:10 +0400
commitcc2352cdd02b36771e17d5ee66946b08f1eb1ab2 (patch)
tree4feab4d04bb0b9deac788752bf77fba0baf789b7 /source
parent0400b2e136e41620b53449b8a8c749af7b1bf03f (diff)
=bmesh=fixed shapekey mem leak
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenlib/intern/scanfill.c4
-rw-r--r--source/blender/bmesh/operators/mesh_conv.c12
-rw-r--r--source/blender/editors/mesh/bmeshutils.c6
3 files changed, 14 insertions, 8 deletions
diff --git a/source/blender/blenlib/intern/scanfill.c b/source/blender/blenlib/intern/scanfill.c
index 40f0176ecab..b5e89530e13 100644
--- a/source/blender/blenlib/intern/scanfill.c
+++ b/source/blender/blenlib/intern/scanfill.c
@@ -172,8 +172,8 @@ static void *new_mem_element(int size)
/*reset the block we're keeping*/
BLI_addtail(&lb, first);
memset(first->data, 0, blocksize);
- cur = first;
- offs = 0;
+ cur= first;
+ offs= 0;
return NULL;
}
diff --git a/source/blender/bmesh/operators/mesh_conv.c b/source/blender/bmesh/operators/mesh_conv.c
index efd038371e0..d9e7077c334 100644
--- a/source/blender/bmesh/operators/mesh_conv.c
+++ b/source/blender/bmesh/operators/mesh_conv.c
@@ -78,8 +78,6 @@ void mesh_to_bmesh_exec(BMesh *bm, BMOperator *op) {
CustomData_set_layer_name(&bm->ldata, CD_MLOOPUV, i, bm->pdata.layers[li].name);
}
- CustomData_add_layer(&bm->vdata, CD_SHAPE_KEYINDEX, CD_ASSIGN, NULL, 0);
-
if (!CustomData_has_layer(&bm->edata, CD_CREASE))
CustomData_add_layer(&bm->edata, CD_CREASE, CD_ASSIGN, NULL, 0);
@@ -96,6 +94,8 @@ void mesh_to_bmesh_exec(BMesh *bm, BMOperator *op) {
actkey = ob_get_keyblock(ob);
if(actkey && actkey->totelem == me->totvert) {
+ CustomData_add_layer(&bm->vdata, CD_SHAPE_KEYINDEX, CD_ASSIGN, NULL, 0);
+
/*check if we need to generate unique ids for the shapekeys.
this also exists in the file reading code, but is here for
a sanity check*/
@@ -142,12 +142,12 @@ void mesh_to_bmesh_exec(BMesh *bm, BMOperator *op) {
/*Copy Custom Data*/
CustomData_to_bmesh_block(&me->vdata, &bm->vdata, i, &v->head.data);
- /*set shape key original index*/
- keyi = CustomData_bmesh_get(&bm->vdata, v->head.data, CD_SHAPE_KEYINDEX);
- *keyi = i;
-
/*set shapekey data*/
if (me->key) {
+ /*set shape key original index*/
+ keyi = CustomData_bmesh_get(&bm->vdata, v->head.data, CD_SHAPE_KEYINDEX);
+ *keyi = i;
+
for (block=me->key->block.first, j=0; block; block=block->next, j++) {
float *co = CustomData_bmesh_get_n(&bm->vdata, v->head.data,
CD_SHAPEKEY, j);
diff --git a/source/blender/editors/mesh/bmeshutils.c b/source/blender/editors/mesh/bmeshutils.c
index 23aa71f9a8e..1aa9d039781 100644
--- a/source/blender/editors/mesh/bmeshutils.c
+++ b/source/blender/editors/mesh/bmeshutils.c
@@ -613,6 +613,12 @@ static void undoMesh_to_editbtMesh(void *umv, void *emv, void *UNUSED(obdata))
static void free_undo(void *umv)
{
+ if (((Mesh*)umv)->key)
+ {
+ free_key(((Mesh*)umv)->key);
+ MEM_freeN(((Mesh*)umv)->key);
+ }
+
free_mesh(umv, 0);
MEM_freeN(umv);
}