Hi, thanks for responding!
JernejL wrote:Do you by any chance remove the bodies inside any of newton callbacks? That will cause a problem.
No - I don't do that. NewtonBody is simply a member of an "entity" object, in my case a spacecraft. I remove this entity by deleting whatever was dynamically allocated, and I also delete the body properly. Here is the code for the entity class destructor:
- Code: Select all
TBEntity::~TBEntity(void)
{
DeleteAllObjectSFX();
DestroyAllHinges();
if(nBody)
{
NewtonDestroyBody(nBody);
nBody = NULL;
}
if (planeCollision)
{
NewtonDestroyCollision(planeCollision);
planeCollision = NULL;
}
delete OrbitSolver;
if(bVerboseTBEntity) TB_PRINTF("TBEntity destructor: Deleting Entity\n");
}
This has worked flawlessly (and still does, in a build from May, which I now have to revert to until I find out what's going on).
The crash happens when I delete an entity, however,
void ApplyForceAndTorqueCallback(const NewtonBody* body, dFloat timestep, int threadIndex) is still being called with invalid
body pointer (not NULL).
Something changed in the Newton build between then and now that is causing this. I can fix it on my side no problem if it is something that was implemented differently - I just need to know what was changed, and how to fix what I have in place...