Closed azeey closed 4 years ago
@mxgrey Do you mind reviewing this? For context, the issue addressed by this PR causes collision detection to fail after skeletons are loaded and unloaded several times. The problem occurs only when there is a memory address collision in the mSkeletonSources
container.
Here's a print out of mSkeletonSources
after running several load/unload cycles via the levels feature of ign-gazebo: https://gist.github.com/azeey/8fe5a55d19758923ef7c1b5df90869d3
And here's the collision detection failing (failure after the 4th cycle):
nice I'm no longer able to get the robot to fall through the tile using this branch
When
subscribeTo
is called with a skeleton inaddSkeleton
, the skeleton is added tomSkeletonSources
. However, insideremoveSkeleton
,unsubscribeFrom
is not called. Instead,removeShapeFrameOf
is called. This is fine for most cases, but if it fails to remove the skeleton frommSkeletonSources
if the skeleton does not have any shapes within it. This causesmSkeletonSources
to grow indefinitely. A hazardous side effect of this is that when an attempt is made to add a new skeleton viasubscribeTo
, the address of the skeleton might be the same as one of the stale entries inmSkeletonSources
. Consequently, the new skeleton's shapes don't get added to the collision detection engine and very surprising results follow.Before creating a pull request
clang-format
Before merging a pull request
CHANGELOG.md