From 106c2fd19dfbd6eeb741a2e8df684702a610f85b Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Tue, 2 May 2023 11:14:36 +0200 Subject: [PATCH] QTimer: fix compilation with C++20 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Implicit capture of *this by [=] is deprecated in C++20, and the replacement [=,this] is not available in C++17. We also can't use [&], because of QueuedConnection, so need to bite the bullet and list all captured variables separately. Amends 87535e4e4337596066258e361143cb9906e89512. Change-Id: I5b3a713bf9220746d10d594d1a248028157ad170 Reviewed-by: MÃ¥rten Nordheim Reviewed-by: Fabian Kosmale Reviewed-by: Giuseppe D'Angelo --- src/corelib/kernel/qtimer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/kernel/qtimer.cpp b/src/corelib/kernel/qtimer.cpp index dccbf37d03b..2e7382d051e 100644 --- a/src/corelib/kernel/qtimer.cpp +++ b/src/corelib/kernel/qtimer.cpp @@ -303,7 +303,7 @@ void QSingleShotTimer::startTimerForReceiver(int msec, Qt::TimerType timerType, moveToThread(receiver->thread()); QDeadlineTimer deadline(std::chrono::milliseconds{msec}, timerType); - QMetaObject::invokeMethod(this, [=]{ + QMetaObject::invokeMethod(this, [this, deadline, timerType]{ if (deadline.hasExpired()) emit timeout(); else