Move DomainParticipant deletion from Impl to delete_participant() #2739
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Signed-off-by: Eran [email protected]
Description
See #2537, #1906, etc.:
The singleton destructor of the
DomainParticipantFactory
is not the problem. Rather, the fact that it deletes all participants is. This PR makes it so it deletes theirimpl_
field, setting it tonullptr
thereby invalidating existing participants so they do not crash, for example when someone then tries todelete_participant()
.Fixes #937
This was tested locally where we see the issue. In the above scenario, the Factory is destroyed before our object, which then sees that the participant is no longer
is_valid()
and does not try to call the factory todelete_participant()
. This, of course, has the side-effect of leaving the participant alive on process exit (so is a "memory leak") but this is much better than the crash that currently occurs and that cannot be avoided if things need destruction on exit.Contributor Checklist
versions.md
file (if applicable).Reviewer Checklist