From 26b69c70fe5437fd46e8fc27b9fe1c867b50ac1d Mon Sep 17 00:00:00 2001 From: Michel Hidalgo Date: Fri, 28 Aug 2020 14:35:15 -0300 Subject: [PATCH] Fix context cleanup. (#227) Drop invalid pointers. Signed-off-by: Michel Hidalgo --- rmw_cyclonedds_cpp/src/rmw_node.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/rmw_cyclonedds_cpp/src/rmw_node.cpp b/rmw_cyclonedds_cpp/src/rmw_node.cpp index 4da0532..e8b5680 100644 --- a/rmw_cyclonedds_cpp/src/rmw_node.cpp +++ b/rmw_cyclonedds_cpp/src/rmw_node.cpp @@ -1091,17 +1091,22 @@ rmw_context_impl_t::clean_up() common.graph_cache.clear_on_change_callback(); if (common.graph_guard_condition) { destroy_guard_condition(common.graph_guard_condition); + common.graph_guard_condition = nullptr; } if (common.pub) { destroy_publisher(common.pub); + common.pub = nullptr; } if (common.sub) { destroy_subscription(common.sub); + common.sub = nullptr; } if (ppant > 0 && dds_delete(ppant) < 0) { RCUTILS_SAFE_FWRITE_TO_STDERR( "Failed to destroy domain in destructor\n"); } + ppant = 0; + check_destroy_domain(domain_id); }