shibd commented on code in PR #17395:
URL: https://github.com/apache/pulsar/pull/17395#discussion_r962327743
##########
pulsar-client-cpp/lib/PeriodicTask.cc:
##########
@@ -27,9 +27,14 @@ void PeriodicTask::start() {
}
state_ = Ready;
if (periodMs_ >= 0) {
- auto self = shared_from_this();
+ std::weak_ptr<PeriodicTask> weakSelf{shared_from_this()};
timer_.expires_from_now(boost::posix_time::millisec(periodMs_));
- timer_.async_wait([this, self](const ErrorCode& ec) {
handleTimeout(ec); });
+ timer_.async_wait([weakSelf](const ErrorCode& ec) {
Review Comment:
Is there a way to use the unit test to cover the destructor that needs to be
executed?
--
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]