Fix context cleanup. (#227)

Drop invalid pointers.

Signed-off-by: Michel Hidalgo <michel@ekumenlabs.com>
This commit is contained in:
Michel Hidalgo 2020-08-28 14:35:15 -03:00 committed by Alejandro Hernández Cordero
parent 0313888422
commit 26b69c70fe

View file

@ -1091,17 +1091,22 @@ rmw_context_impl_t::clean_up()
common.graph_cache.clear_on_change_callback(); common.graph_cache.clear_on_change_callback();
if (common.graph_guard_condition) { if (common.graph_guard_condition) {
destroy_guard_condition(common.graph_guard_condition); destroy_guard_condition(common.graph_guard_condition);
common.graph_guard_condition = nullptr;
} }
if (common.pub) { if (common.pub) {
destroy_publisher(common.pub); destroy_publisher(common.pub);
common.pub = nullptr;
} }
if (common.sub) { if (common.sub) {
destroy_subscription(common.sub); destroy_subscription(common.sub);
common.sub = nullptr;
} }
if (ppant > 0 && dds_delete(ppant) < 0) { if (ppant > 0 && dds_delete(ppant) < 0) {
RCUTILS_SAFE_FWRITE_TO_STDERR( RCUTILS_SAFE_FWRITE_TO_STDERR(
"Failed to destroy domain in destructor\n"); "Failed to destroy domain in destructor\n");
} }
ppant = 0;
check_destroy_domain(domain_id); check_destroy_domain(domain_id);
} }