BewareMyPower commented on code in PR #386:
URL: https://github.com/apache/pulsar-client-cpp/pull/386#discussion_r1451570322
##########
lib/ConsumerImpl.cc:
##########
@@ -1508,18 +1508,33 @@ void
ConsumerImpl::hasMessageAvailableAsync(HasMessageAvailableCallback callback
if (messageId == MessageId::latest()) {
lock.unlock();
- getLastMessageIdAsync([callback](Result result, const
GetLastMessageIdResponse& response) {
+ getLastMessageIdAsync([this, callback](Result result, const
GetLastMessageIdResponse& response) {
Review Comment:
You should capture the `shared_ptr` or `weak_ptr` in case the `ConsumerImpl`
instance (that `this` points to) has been destroyed when the callback of
`getLastMessageIdAsync` is called.
--
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]