Code: Select all
cpSpaceRemoveShape(space,shape);
cpSpaceRemoveBody(space,body);
cpBodyFree(body);
cpShapeFree(shape);
Code: Select all
cpSpaceRemoveStaticShape(space,shape);
cpShapeFree(shape);
occasionally I'm getting an error and MSVC says "Windows has triggered a breakpoint, this may indicate a corruption in the heap" or something like that, and points at the freeBins call in this:
Code: Select all
void
cpSpaceHashDestroy(cpSpaceHash *hash)
{
clearHash(hash);
freeBins(hash);
// Free the handles.
cpHashSetEach(hash->handleSet, &handleFreeWrap, NULL);
cpHashSetFree(hash->handleSet);
free(hash->table);
}
I am not freeing and removing the objects in a collision callback. Should I be doing it at some specific time during the simulation loop? currently it's done through the glut mouse callback. Do you think that's a problem? I am still trying to find something specific that I can do to trigger the error.