Re[2]: [ODE] a bug in dBodyDestroy

slipch slipch <slipch at gsc-game.kiev.ua>
Fri Feb 21 01:42:01 2003


Hello David,

It seems the best solution is simply cash the pointer to the next
geom. I do it very trivial:

  dxGeom* body_next_geom;
  for (dxGeom *geom = b->geom; geom; geom = body_next_geom) {
    body_next_geom=dGeomGetBodyNext (geom);
    dGeomSetBody (geom,0);
  }







Friday, February 21, 2003, 1:37:22 AM, you wrote:

DM> Eeek!!! nice catch. I think I've seen this too but couldn't quite figure it out.  I'm using multiple geoms per body as well.  Do you have a patch for Russ to commit?  Would this work...

DM> void dBodyDestroy (dxBody *b)
DM> {
DM>   dAASSERT (b);

DM>   // all geoms that link to this body must be notified that the body is about
DM>   // to disappear. 
DM>   while (b->geom) {
DM>     dGeomSetBody (b->geom,0);
DM>     // note: dGeomSetBody() will remove the geom from our list!
DM>   }

DM>   <snip>
DM> }