diff --git a/rmw_zenoh_cpp/src/detail/rmw_data_types.cpp b/rmw_zenoh_cpp/src/detail/rmw_data_types.cpp index d39084ae..0d288964 100644 --- a/rmw_zenoh_cpp/src/detail/rmw_data_types.cpp +++ b/rmw_zenoh_cpp/src/detail/rmw_data_types.cpp @@ -465,15 +465,15 @@ void sub_data_handler(const z_loaned_sample_t *sample, void *data) { ///============================================================================= ZenohQuery::ZenohQuery(const z_loaned_query_t *query) { - z_query_clone(query_, query); + z_query_clone(&query_, query); } ///============================================================================= -ZenohQuery::~ZenohQuery() { z_drop(z_move(*query_)); } +ZenohQuery::~ZenohQuery() { z_drop(z_move(query_)); } ///============================================================================= const z_loaned_query_t *ZenohQuery::get_query() const { - return z_query_loan(query_); + return z_query_loan(&query_); } //============================================================================== diff --git a/rmw_zenoh_cpp/src/detail/rmw_data_types.hpp b/rmw_zenoh_cpp/src/detail/rmw_data_types.hpp index 78308a86..574e0d76 100644 --- a/rmw_zenoh_cpp/src/detail/rmw_data_types.hpp +++ b/rmw_zenoh_cpp/src/detail/rmw_data_types.hpp @@ -217,7 +217,7 @@ class ZenohQuery final const z_loaned_query_t * get_query() const; private: - z_owned_query_t * query_{nullptr}; + z_owned_query_t query_; }; ///=============================================================================