From cd08966cbce314542d4e72576c3c7746b4b9b8df Mon Sep 17 00:00:00 2001 From: Richard Barnes Date: Mon, 18 Dec 2023 20:47:49 -0800 Subject: [PATCH] Fix deprecated this capture in wangle/bootstrap/AcceptRoutingHandler-inl.h Summary: In the future LLVM will require that lambdas capture `this` explicitly. `-Wdeprecated-this-capture` checks for and enforces this now. This diff adds an explicit `this` capture to a lambda to fix an issue that presents similarly to this: ``` -> fbcode/path/to/my_file.cpp:66:47: error: implicit capture of 'this' with a capture default of '=' is deprecated [-Werror,- Wdeprecated-this-capture] -> detail::createIOWorkerProvider(evb, requestsRegistry_); -> ^ -> fbcode/path/to/my_file.cpp:61:30: note: add an explicit capture of 'this' to capture '*this' by reference -> evb->runInEventBaseThread([=, self_weak = std::move(self_weak)]() { -> ^ -> , this ``` Reviewed By: meyering Differential Revision: D52279231 fbshipit-source-id: 9b9ae7dc3f4c2e65764bb45457cb6538f69a2d62 --- wangle/bootstrap/AcceptRoutingHandler-inl.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/wangle/bootstrap/AcceptRoutingHandler-inl.h b/wangle/bootstrap/AcceptRoutingHandler-inl.h index cf2637e9e..9a0302559 100644 --- a/wangle/bootstrap/AcceptRoutingHandler-inl.h +++ b/wangle/bootstrap/AcceptRoutingHandler-inl.h @@ -99,10 +99,10 @@ void AcceptRoutingHandler::onRoutingData( auto acceptor = acceptors_[hash % acceptors_.size()]; originalEvb->runInLoop( - [=, routingData = std::move(routingData)]() mutable { + [=, this, routingData = std::move(routingData)]() mutable { // Switch to the new acceptor's thread acceptor->getEventBase()->runInEventBaseThread( - [=, routingData = std::move(routingData)]() mutable { + [=, this, routingData = std::move(routingData)]() mutable { socket->attachEventBase(acceptor->getEventBase()); auto routingHandler =