You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by "shibd (via GitHub)" <gi...@apache.org> on 2023/09/19 12:40:40 UTC

[GitHub] [pulsar-client-cpp] shibd commented on a diff in pull request #317: Avoid accessing a null ClientConnection instance

shibd commented on code in PR #317:
URL: https://github.com/apache/pulsar-client-cpp/pull/317#discussion_r1330063964


##########
lib/ClientConnection.cc:
##########
@@ -597,10 +636,15 @@ void ClientConnection::handleResolve(const boost::system::error_code& err,
 
 void ClientConnection::readNextCommand() {
     const static uint32_t minReadSize = sizeof(uint32_t);
+    auto weakSelf = weak_from_this();
     asyncReceive(
         incomingBuffer_.asio_buffer(),
-        customAllocReadHandler(std::bind(&ClientConnection::handleRead, shared_from_this(),

Review Comment:
   This is the root cause, right? ClientConnection object may have been destroyed before calling `handleRead`
   
   



-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org