From 31ca933b4fd154959288448244881c6105c26d37 Mon Sep 17 00:00:00 2001 From: Yuyuan Yuan Date: Mon, 23 Dec 2024 23:56:44 +0800 Subject: [PATCH] fix: wrap a short-lived keyexpr in a `std::string` (#359) (cherry picked from commit 57a6b4b8f07b86d9ab140b9e0c204055d885c5e2) --- rmw_zenoh_cpp/src/detail/rmw_service_data.cpp | 2 +- rmw_zenoh_cpp/src/detail/rmw_subscription_data.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/rmw_zenoh_cpp/src/detail/rmw_service_data.cpp b/rmw_zenoh_cpp/src/detail/rmw_service_data.cpp index 769ff47e..8bbd9d0b 100644 --- a/rmw_zenoh_cpp/src/detail/rmw_service_data.cpp +++ b/rmw_zenoh_cpp/src/detail/rmw_service_data.cpp @@ -157,7 +157,7 @@ std::shared_ptr ServiceData::make( RMW_ZENOH_LOG_ERROR_NAMED( "rmw_zenoh_cpp", "Unable to obtain ServiceData from data for %s.", - query.get_keyexpr().as_string_view()); + std::string(query.get_keyexpr().as_string_view()).c_str()); return; } diff --git a/rmw_zenoh_cpp/src/detail/rmw_subscription_data.cpp b/rmw_zenoh_cpp/src/detail/rmw_subscription_data.cpp index cce67b33..83d06139 100644 --- a/rmw_zenoh_cpp/src/detail/rmw_subscription_data.cpp +++ b/rmw_zenoh_cpp/src/detail/rmw_subscription_data.cpp @@ -208,7 +208,7 @@ bool SubscriptionData::init() RMW_ZENOH_LOG_ERROR_NAMED( "rmw_zenoh_cpp", "Unable to obtain SubscriptionData from data for %s.", - sample.get_keyexpr().as_string_view()); + std::string(sample.get_keyexpr().as_string_view()).c_str()); return; }