[PATCH v1] apps: cam: Fix C++20 deprecation warning
Umang Jain
umang.jain at ideasonboard.com
Fri May 3 14:04:56 CEST 2024
Hi,
On 03/05/24 5:32 pm, Laurent Pinchart wrote:
> Hi Umang,
>
> On Fri, May 03, 2024 at 04:24:47PM +0530, Umang Jain wrote:
>> Hi Barnabás
>>
>> On 01/05/24 12:56 am, Barnabás Pőcze wrote:
>>> C++20 deprecated implicit capture of `this` via `[=]`.
>>> Fix that by explicitly capturing the necessary variables.
>>>
>>> Signed-off-by: Barnabás Pőcze <pobrn at protonmail.com>
>> Thank you for the patch.
>>
>> Reviewed-by: Umang Jain <umang.jain at ideasonboard.com>
>>
>> There is one more instance of "[=]" which I think is also a similar
>> candidate...
>>
>> auto encoder = std::find_if(encoders.begin(),
>> encoders.end(),
>> [=](const Encoder &e) {
>> return e.id() ==
>> encoderId;
>> });
>>
>> in src/apps/cam/drm.cpp
> That lambda function doesn't capture 'this'. 'e' is a parameter to the
> function, and 'encoderId' is a local variable.
Ah yes, that's correct. Got confused on looking at 'encoderId'
Sorry for the noise.
>
>> It can be a patch squashed in this one, or a patch on top (I prefer the
>> former though).
>>
>>> ---
>>> src/apps/cam/camera_session.cpp | 2 +-
>>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/src/apps/cam/camera_session.cpp b/src/apps/cam/camera_session.cpp
>>> index 334d2ed8..d1f65a99 100644
>>> --- a/src/apps/cam/camera_session.cpp
>>> +++ b/src/apps/cam/camera_session.cpp
>>> @@ -382,7 +382,7 @@ void CameraSession::requestComplete(Request *request)
>>> * Defer processing of the completed request to the event loop, to avoid
>>> * blocking the camera manager thread.
>>> */
>>> - EventLoop::instance()->callLater([=]() { processRequest(request); });
>>> + EventLoop::instance()->callLater([this, request]() { processRequest(request); });
>>> }
>>>
>>> void CameraSession::processRequest(Request *request)
More information about the libcamera-devel
mailing list