Bugfix: memory leak with multi-modifier, if the modifier
using the previous coordinates was disabled.
This commit is contained in:
parent
a4dc7c6676
commit
f33f7ed62a
|
@ -292,6 +292,7 @@ struct Object *modifiers_isDeformedByArmature(struct Object *ob);
|
|||
struct Object *modifiers_isDeformedByLattice(struct Object *ob);
|
||||
int modifiers_usesArmature(struct Object *ob, struct bArmature *arm);
|
||||
int modifiers_isDeformed(struct Object *ob);
|
||||
void modifier_freeTemporaryData(struct ModifierData *md);
|
||||
|
||||
int modifiers_indexInObject(struct Object *ob, struct ModifierData *md);
|
||||
|
||||
|
|
|
@ -1877,7 +1877,7 @@ static void mesh_calc_modifiers(Object *ob, float (*inputVertexCos)[3],
|
|||
int needMapping, CustomDataMask dataMask)
|
||||
{
|
||||
Mesh *me = ob->data;
|
||||
ModifierData *md = modifiers_getVirtualModifierList(ob);
|
||||
ModifierData *firstmd, *md;
|
||||
LinkNode *datamasks, *curr;
|
||||
CustomDataMask mask;
|
||||
float (*deformedVerts)[3] = NULL;
|
||||
|
@ -1886,6 +1886,8 @@ static void mesh_calc_modifiers(Object *ob, float (*inputVertexCos)[3],
|
|||
int fluidsimMeshUsed = 0;
|
||||
int required_mode;
|
||||
|
||||
md = firstmd = modifiers_getVirtualModifierList(ob);
|
||||
|
||||
modifiers_clearErrors(ob);
|
||||
|
||||
/* we always want to keep original indices */
|
||||
|
@ -2097,6 +2099,9 @@ static void mesh_calc_modifiers(Object *ob, float (*inputVertexCos)[3],
|
|||
}
|
||||
}
|
||||
|
||||
for(md=first; md; md=md->next)
|
||||
modifier_freeTemporaryData(md);
|
||||
|
||||
/* Yay, we are done. If we have a DerivedMesh and deformed vertices
|
||||
* need to apply these back onto the DerivedMesh. If we have no
|
||||
* DerivedMesh then we need to build one.
|
||||
|
|
|
@ -7219,3 +7219,14 @@ int modifiers_usesPointCache(Object *ob)
|
|||
return 0;
|
||||
}
|
||||
|
||||
void modifier_freeTemporaryData(ModifierData *md)
|
||||
{
|
||||
if(md->type == eModifierType_Armature) {
|
||||
ArmatureModifierData *amd= (ArmatureModifierData*)md;
|
||||
|
||||
if(amd->prevCos)
|
||||
MEM_freeN(amd->prevCos);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue