acelyc111 commented on code in PR #2302:
URL: 
https://github.com/apache/incubator-pegasus/pull/2302#discussion_r2463333516


##########
src/meta/test/meta_state/meta_state_service.cpp:
##########
@@ -61,87 +62,112 @@ void provider_basic_test(const service_creator_func 
&service_creator,
                          const service_deleter_func &service_deleter)
 {
     // environment
-    auto service = service_creator();
+    auto *service = service_creator();
 
     // bondary check
-    service->node_exist("/", META_STATE_SERVICE_SIMPLE_TEST_CALLBACK, 
expect_ok)->wait();

Review Comment:
   Yes, the google-default-arguments rule is aim to prevent different default 
values on base class and derived class, but if we ensure they are the same 
deterministically, maybe we can use this.



##########
src/zookeeper/zookeeper_session.cpp:
##########
@@ -398,58 +399,64 @@ void zookeeper_session::visit(zoo_opcontext *ctx)
         _watchers.back().watcher_callback = 
std::move(ctx->_input._watcher_callback);
     };
 
-    // TODO: the read ops from zookeeper might get the staled data, need to fix
+    // TODO(clang-tidy): the read ops from zookeeper might get the staled 
data, need to fix
     int ec = ZOK;
     zoo_input &input = ctx->_input;
-    const char *path = input._path.c_str();
+
+    // A local variable is needed here to hold a reference to `_path` to 
prevent it from
+    // being freed in the thread executing the completion callback, which 
could otherwise
+    // lead to a dangling pointer issue.
+    const std::shared_ptr<std::string> path(input._path);

Review Comment:
   Is this the key changes of this PR?
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to