gazebosim / gz-sim

Open source robotics simulator. The latest version of Gazebo.
https://gazebosim.org
Apache License 2.0
619 stars 251 forks source link

Fix bug where iterator was used after the underlying item was erased from the container #2412

Closed azeey closed 1 month ago

azeey commented 1 month ago

🦟 Bug fix

Fixes #2198

Summary

Reorders the erase operations to avoid using an invalidated iterator. This is already done in the ign-gazebo6 branch: https://github.com/gazebosim/gz-sim/blob/fb3f3d43eee648e387f89d611dd2a9973fff201e/src/systems/physics/EntityFeatureMap.hh#L255-L286

Checklist

Note to maintainers: Remember to use Squash-Merge and edit the commit message to match the pull request summary while retaining Signed-off-by messages.