diff --git a/rmw_zenoh_cpp/src/detail/rmw_data_types.hpp b/rmw_zenoh_cpp/src/detail/rmw_data_types.hpp index f10e84f3..fc719953 100644 --- a/rmw_zenoh_cpp/src/detail/rmw_data_types.hpp +++ b/rmw_zenoh_cpp/src/detail/rmw_data_types.hpp @@ -297,7 +297,6 @@ class rmw_client_data_t final std::shared_ptr entity; z_owned_keyexpr_t keyexpr; - z_owned_closure_reply_t zn_closure_reply; // Store the actual QoS profile used to configure this client. // The QoS is reused for sending requests and getting responses. diff --git a/rmw_zenoh_cpp/src/rmw_zenoh.cpp b/rmw_zenoh_cpp/src/rmw_zenoh.cpp index e221e398..6ee087d2 100644 --- a/rmw_zenoh_cpp/src/rmw_zenoh.cpp +++ b/rmw_zenoh_cpp/src/rmw_zenoh.cpp @@ -2350,7 +2350,6 @@ rmw_destroy_client(rmw_node_t * node, rmw_client_t * client) return RMW_RET_INVALID_ARGUMENT); // CLEANUP =================================================================== - z_drop(z_move(client_data->zn_closure_reply)); z_drop(z_move(client_data->keyexpr)); zc_liveliness_undeclare_token(z_move(client_data->token)); @@ -2464,11 +2463,13 @@ rmw_send_request( // and any number. opts.consolidation = z_query_consolidation_latest(); opts.value.payload = z_bytes_t{data_length, reinterpret_cast(request_bytes)}; - client_data->zn_closure_reply = + z_owned_closure_reply_t zn_closure_reply = z_closure(rmw_zenoh_cpp::client_data_handler, nullptr, client_data); z_get( - z_loan(context_impl->session), z_loan( - client_data->keyexpr), "", &client_data->zn_closure_reply, &opts); + z_loan(context_impl->session), + z_loan(client_data->keyexpr), "", + z_move(zn_closure_reply), + &opts); return RMW_RET_OK; }