graspit-simulator / graspit

The GraspIt! simulator
http://graspit-simulator.github.io/
Other
180 stars 81 forks source link

Remove body within loop #136

Closed JenniferBuehler closed 6 years ago

JenniferBuehler commented 6 years ago

This is a bug I found a while back which caused me a segmentation fault or other error - I can't remember the occasion, but it was detrimental to add this fix. I think I was adding and then removing objects from the world.

We need to remove the body from the collision interface ONLY if the body is actually still in the World. Otherwise we get an error from the collision interface when the Body has been removed from the World earlier, but destroyElement() is still used as destructor method, e.g. from the Robot destructor.

Basically, only objects added to the world should exist in the collision interface. If also objects which are NOT part of the world should be able to exist in the collision interface, this PR would be wrong. But because WorldElement inherently is meant to be part of World (and also are QObject children of World, which was relevant to this bug happening), I assume that the following change is desirable.

JenniferBuehler commented 6 years ago

Any comments on this? ;) Would you consider this update? I'm trying to sync my fork 100% with your repo, and that's one missing feature still.

Cheers

JenniferBuehler commented 6 years ago

Awesome, thanks :)