From a9e995f04174bfe9658a8912743f486240b3dc71 Mon Sep 17 00:00:00 2001 From: Yadunund Date: Thu, 19 Sep 2024 23:39:16 +0800 Subject: [PATCH] Also check is_shutdown Signed-off-by: Yadunund --- rmw_zenoh_cpp/src/rmw_zenoh.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rmw_zenoh_cpp/src/rmw_zenoh.cpp b/rmw_zenoh_cpp/src/rmw_zenoh.cpp index c9fa1f7b..dc86789d 100644 --- a/rmw_zenoh_cpp/src/rmw_zenoh.cpp +++ b/rmw_zenoh_cpp/src/rmw_zenoh.cpp @@ -326,7 +326,7 @@ rmw_destroy_node(rmw_node_t * node) // Erase the node from the set of session_nodes and close the Zenoh // session if this is the last node. node->context->impl->session_nodes_.erase(node); - if (node->context->impl->session_nodes_.empty()) { + if (node->context->impl->session_nodes_.empty() && node->context->impl->is_shutdown) { // Close the zenoh session if (z_close(z_move(node->context->impl->session), NULL) != Z_OK) { RMW_SET_ERROR_MSG("Error while closing zenoh session");