[ODE] Destroying Body before Geom

Guillaume Jouffroy oxymore at tele2.fr
Thu Oct 20 13:23:58 MST 2005


Chris Osborn a écrit :

> Hi guys,
>
> How does one correctly destroy a body before the geom associated with 
> it? I have a base class with a dGeomID and a derived class with a 
> dBodyID . Since the derived classes destructor is called first, 
> dBodyDestroy is called before dGeomDestroy.
>
> ~Derived()
> {
>    dBodyDestroy(mBodyID);
> }
>
> ~Base()
> {
>    dGeomDestroy(mGeomID);
> }
>
> This results in a access violation in collision_kernel.cpp:
>
> dxGeom *dGeomGetBodyNext (dxGeom *geom)
> {
>   return geom->body_next;  //right here, where geom is a bad pointer
> }
>
> I've tried calling dGeomSetBody(mGeomID, 0) prior to dBodyDestory, 
> hoping to decouple the two. But then it dies in dxGeom::bodyRemove().
>
> Any ideas?
>
> Thanks
> -chris
>
> _______________________________________________
> ODE mailing list
> ODE at q12.org
> http://q12.org/mailman/listinfo/ode
>
When you destroy a body the geoms assosociated to it are destroyed as well


More information about the ODE mailing list