Closed azeey closed 3 months ago
Attention: Patch coverage is 94.44444%
with 1 lines
in your changes are missing coverage. Please review.
Project coverage is 87.85%. Comparing base (
eac2e69
) to head (1f2d6f4
). Report is 6 commits behind head on gz-transport13.
Files | Patch % | Lines |
---|---|---|
src/NodeShared.cc | 91.66% | 1 Missing :warning: |
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
I can go ahead and merge this, but I think we should make a prerelease and test gz-sim before making a full release. @iche033 or @caguero can I ask one of you to do that please?
🦟 Bug fix
Summary
Currently,
NodeShared
is never destroyed once it's created. This makes it hard for writing tests that do not interfere with each other. This patch uses a reference counted smart pointer (std::shared_ptr
) to keep track ofNodeShared
instances, so that it gets properly destroyed when when allNode
instances, which themselves containNodeShared
instances are destroyed.This was brought up in https://github.com/gazebosim/gz-sim/pull/2334. The
INTEGRATION_triggered_publisher
test fails reliably in my local tests without this gz-transport PR.~TODO: This is probably not threadsafe. It's possible to lock a mutex before checking the weak_ptr, but that would make the call to
NodeSHared::Instance
slower than the previous implementation since it was usingstd::shared_mutex
.~Checklist
codecheck
passed (See contributing)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.