[Bf-committers] Memory bug
raulf at info.upr.edu.cu
raulf at info.upr.edu.cu
Thu Feb 10 17:40:46 CET 2011
Hi :)
In order to finish and release the new mesh smoothing/relaxation patches I
have being working on I'm rewritting them to avoid introducing new fields
inside the EditVert structure, so I end up using the union tmp inside that
structure that is for temporal data storage... well, here is where the
problems comes.
I need to store a vector float ,float[3], inside the (void *)vert->tmp.p
field
so I use this:
float *vert= (float *)MEM_callocN(3*me->totverts*sizeof(float ),
"vertsmooth");
eve= em->verts.first;
int counter = 0;
while(eve) {
if(eve->f & SELECT) {
(eve->tmp).p = &vert[counter];
(eve->tmp).fp = 0.f;
counter+=3;
}
eve= eve->next;
}
but when I call some other function to perate on them I get memory
corrupted values, for example, when I call
add_v3_v3(&eed->v1->tmp.p,eed->v2->co);
and if I use
add_v3_v3(eed->v1->tmp.p,eed->v2->co); I get inmediately system halt.
perhaps the solution is in front of me but I have tried all pointer magic
combination :(
I use this because in other parts of the Blender source code is
implemented in a very similar way.
Thanks in advance
Farsthary
More information about the Bf-committers
mailing list