From 75249a77b62bd472e598d890c171d50337c236c8 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Wed, 2 Aug 2023 09:12:47 +0200 Subject: [PATCH] DefaultCompositor: use explcit lambda captures C++20 deprecates the capture of *this in [=], and using [&] in a connect() statement is a smell ("are we capturing local variables?"), so just be explicit about what variables we capture (it's mostly [this], anyway). Amends f6dd4ab120f2f3822a19233233e791d4449e134a. Pick-to: 6.6 6.5 6.2 5.15 Change-Id: Ia594ffd5c0b9e82c54aa67c74b0d59684aa92840 Reviewed-by: Ivan Solovev --- tests/auto/wayland/shared/mockcompositor.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/auto/wayland/shared/mockcompositor.cpp b/tests/auto/wayland/shared/mockcompositor.cpp index 946e87ed6a7..5748c51ae57 100644 --- a/tests/auto/wayland/shared/mockcompositor.cpp +++ b/tests/auto/wayland/shared/mockcompositor.cpp @@ -37,8 +37,8 @@ DefaultCompositor::DefaultCompositor(CompositorType t, int socketFd) // TODO: other shells, viewporter, xdgoutput etc - QObject::connect(get(), &WlCompositor::surfaceCreated, [&] (Surface *surface){ - QObject::connect(surface, &Surface::bufferCommitted, [=] { + QObject::connect(get(), &WlCompositor::surfaceCreated, [this] (Surface *surface){ + QObject::connect(surface, &Surface::bufferCommitted, [this, surface] { if (m_config.autoRelease) { // Pretend we made a copy of the buffer and just release it immediately surface->m_committed.buffer->send_release(); @@ -49,7 +49,7 @@ DefaultCompositor::DefaultCompositor(CompositorType t, int socketFd) }); }); - QObject::connect(get(), &XdgWmBase::toplevelCreated, get(), [&] (XdgToplevel *toplevel) { + QObject::connect(get(), &XdgWmBase::toplevelCreated, get(), [this] (XdgToplevel *toplevel) { if (m_config.autoConfigure) toplevel->sendCompleteConfigure(); }, Qt::DirectConnection);