[PATCH v1] apps: cam: Fix C++20 deprecation warning
Laurent Pinchart
laurent.pinchart at ideasonboard.com
Fri May 3 05:12:52 CEST 2024
On Fri, May 03, 2024 at 02:58:45AM +0300, Laurent Pinchart wrote:
> On Thu, May 02, 2024 at 11:40:42PM +0000, Barnabás Pőcze wrote:
> > 2024. május 3., péntek 1:13 keltezéssel, Laurent Pinchart írta:
> > > On Tue, Apr 30, 2024 at 07:26:21PM +0000, 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>
> > >
> > > Reviewed-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>
> > >
> > > It would be nice if there was a way to enable this warning even with
> > > C++17, but it's covered by -Wdeprecated :-S
> >
> > In the CI one could do builds with `meson setup ... -D cpp_std=c++20`.
>
> That's a good idea.
The result is surprising:
https://gitlab.freedesktop.org/pinchartl/libcamera/-/jobs/58304138
I don't think I'll have time to investigate this very soon.
> > It almost builds, there is one other issue still:
> >
> > /libcamera/src/apps/qcam/main_window.cpp:193:38: error: bitwise operation between different enumeration types ‘Qt::Modifier’ and ‘Qt::Key’ is deprecated [-Werror=deprecated-enum-enum-conversion]
> > 193 | action->setShortcut(Qt::CTRL | Qt::Key_Q);
> > | ~~~~~~~~~^~~~~~~~~~~
>
> I'm working on fixing that one :-)
The fix is on the list.
> > > > ---
> > > > 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)
--
Regards,
Laurent Pinchart
More information about the libcamera-devel
mailing list