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 <ivan.solovev@qt.io>
This commit is contained in:
Marc Mutz 2023-08-02 09:12:47 +02:00
parent f195fed91a
commit 75249a77b6

View File

@ -37,8 +37,8 @@ DefaultCompositor::DefaultCompositor(CompositorType t, int socketFd)
// TODO: other shells, viewporter, xdgoutput etc
QObject::connect(get<WlCompositor>(), &WlCompositor::surfaceCreated, [&] (Surface *surface){
QObject::connect(surface, &Surface::bufferCommitted, [=] {
QObject::connect(get<WlCompositor>(), &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>(), &XdgWmBase::toplevelCreated, get<XdgWmBase>(), [&] (XdgToplevel *toplevel) {
QObject::connect(get<XdgWmBase>(), &XdgWmBase::toplevelCreated, get<XdgWmBase>(), [this] (XdgToplevel *toplevel) {
if (m_config.autoConfigure)
toplevel->sendCompleteConfigure();
}, Qt::DirectConnection);