summaryrefslogtreecommitdiffstats
path: root/src/corelib/kernel/qtimer.cpp
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@qt.io>2023-05-02 11:14:36 +0200
committerMarc Mutz <marc.mutz@qt.io>2023-05-02 18:32:01 +0200
commit106c2fd19dfbd6eeb741a2e8df684702a610f85b (patch)
tree48e58d1289c812449845ebc3f99a2add72cfcd60 /src/corelib/kernel/qtimer.cpp
parent51bcad8a614bafb8be6a98ea8c709a7f3669ff37 (diff)
QTimer: fix compilation with C++20
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 <marten.nordheim@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Diffstat (limited to 'src/corelib/kernel/qtimer.cpp')
-rw-r--r--src/corelib/kernel/qtimer.cpp2
1 files changed, 1 insertions, 1 deletions
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