From d184f4153c9f8e4becaa6367700b3f513f8e05a3 Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo Date: Wed, 13 Sep 2023 16:43:00 +0200 Subject: [PATCH] QDBusMarshall test: avoid an atomic assignment There's no need for atomic semantics for a simple "scope value rollback" (not sure why the code doesn't use the real thing). There's also no semantics that make sense. Extract the integer out of the atomic and store it back. Change-Id: I8ba89216d1931a73ff22a8af7fd656c3f6948793 Reviewed-by: Thiago Macieira --- tests/auto/dbus/qdbusmarshall/tst_qdbusmarshall.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/auto/dbus/qdbusmarshall/tst_qdbusmarshall.cpp b/tests/auto/dbus/qdbusmarshall/tst_qdbusmarshall.cpp index 03af2f86e0..2d12bba356 100644 --- a/tests/auto/dbus/qdbusmarshall/tst_qdbusmarshall.cpp +++ b/tests/auto/dbus/qdbusmarshall/tst_qdbusmarshall.cpp @@ -1068,12 +1068,12 @@ typedef QScopedPointer ScopedDBusConnection; typedef QScopedPointer ScopedDBusMessage; typedef QScopedPointer ScopedDBusPendingCall; -template struct SetResetValue +template struct SetResetValue { - const T oldValue; + const T2 oldValue; T &value; public: - SetResetValue(T &v, T newValue) : oldValue(v), value(v) + SetResetValue(T &v, T2 newValue) : oldValue(v), value(v) { value = newValue; } @@ -1120,8 +1120,8 @@ void tst_QDBusMarshall::receiveUnknownType() // make sure this QDBusConnection won't handle Unix file descriptors QAtomicInt &capabRef = QDBusConnectionPrivate::d(con)->capabilities; - SetResetValue resetter(capabRef, - capabRef & ~QDBusConnection::UnixFileDescriptorPassing); + SetResetValue resetter(capabRef, + capabRef & ~QDBusConnection::UnixFileDescriptorPassing); if (qstrcmp(QTest::currentDataTag(), "in-call") == 0) { // create a call back to us containing a file descriptor