[ODE] Test_buggy crashing?

J. Perkins starkos at gmail.com
Fri Mar 17 12:07:47 MST 2006


On 3/17/06, J. Perkins <starkos at gmail.com> wrote:
> Using the latest code from svn, test_buggy is crashing at
> collision_kernel.cpp(303) when it tries to exit. It is happening in
> the cleanup code at the end of the sample:

My guess was right. The buggy_test creates a geom, then creates a
body, then calls dGeomAddBody() to connect them. When the program
exits, it calls dWorldDestroy() which deletes all of the bodies. It
then calls dGeomDestroy(), which tries to detach itself from the
already deleted body. VS.NET writes a dummy value into all deleted
memory, so the body pointer is invalid and it crashes. GCC doesn't
write a value into deleted memory, so the pointer value still looks
okay, even though it is pointing to deleted memory.

I fixed the problem by moving the calls dGeomDestroy() ahead of the
call to dWorldDestroy(), which makes more sense anyway. I will check
this in now.

Jason



More information about the ODE mailing list