This project has moved. For the latest updates, please go here.

Body.Dispose and Fixture.Dispose

Topics: Developer Forum
Mar 20, 2011 at 6:42 AM

I've come across a bit of a problem with the Dispose methods in the Body class and the Fixture class. What I'm currently doing in my code is to create a body, then later use that to create a fixture. When I'm done with them, they are both disposed separately. The problem is, when the fixture is disposed, it also disposes the body - so when I call Body.Dispose() in my own code, it causes the body to be removed from the world twice (which causes a debug assertion).

The documentation for IDisposable.Dispose states that an implementation of Dispose must ignore all calls after the first one. I would suggest implementing a boolean IsDisposed property in the Body and Fixture classes, to prevent crashes due to double-dispose.

Mar 20, 2011 at 12:26 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.