summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/kernel/qobject/tst_qobject.cpp
diff options
context:
space:
mode:
authorVolker Hilsheimer <volker.hilsheimer@qt.io>2023-05-20 11:14:00 +0200
committerVolker Hilsheimer <volker.hilsheimer@qt.io>2023-05-25 14:06:55 +0200
commit16cf095bd5018d8fd935233c3fa54eb85c685ea3 (patch)
treede6a90de17bc3e3a8f92251d26a7b14086be2785 /tests/auto/corelib/kernel/qobject/tst_qobject.cpp
parent833da1f31c27e4e3d2b910f379ea1db595ed8f11 (diff)
Silence warning from unused variable in QObject test
It's not needed, but makes the point for having a mutable lambda in the first place. Change-Id: I483862d6aee90bb62d4b5363c56a80bb05e14df7 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'tests/auto/corelib/kernel/qobject/tst_qobject.cpp')
-rw-r--r--tests/auto/corelib/kernel/qobject/tst_qobject.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/tests/auto/corelib/kernel/qobject/tst_qobject.cpp b/tests/auto/corelib/kernel/qobject/tst_qobject.cpp
index 5cb9faf01f..73b77932ce 100644
--- a/tests/auto/corelib/kernel/qobject/tst_qobject.cpp
+++ b/tests/auto/corelib/kernel/qobject/tst_qobject.cpp
@@ -8586,7 +8586,11 @@ void tst_QObject::asyncCallbackHelper()
QCOMPARE(called, 1);
QMetaObject::invokeMethod(this, [&called, u = std::unique_ptr<int>()]{ called = 2; });
QCOMPARE(called, 2);
- QMetaObject::invokeMethod(this, [&called, count = 0]() mutable { called = 3; });
+ QMetaObject::invokeMethod(this, [&called, count = 0]() mutable {
+ if (!count)
+ called = 3;
+ ++count;
+ });
QCOMPARE(called, 3);
}
}