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 <thiago.macieira@intel.com>
This commit is contained in:
parent
16433a4a6e
commit
d184f4153c
@ -1068,12 +1068,12 @@ typedef QScopedPointer<DBusConnection, DisconnectRawDBus> ScopedDBusConnection;
|
||||
typedef QScopedPointer<DBusMessage, UnrefDBusMessage> ScopedDBusMessage;
|
||||
typedef QScopedPointer<DBusPendingCall, UnrefDBusPendingCall> ScopedDBusPendingCall;
|
||||
|
||||
template <typename T> struct SetResetValue
|
||||
template <typename T, typename T2 = T> 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<QAtomicInt> resetter(capabRef,
|
||||
capabRef & ~QDBusConnection::UnixFileDescriptorPassing);
|
||||
SetResetValue<QAtomicInt, int> resetter(capabRef,
|
||||
capabRef & ~QDBusConnection::UnixFileDescriptorPassing);
|
||||
|
||||
if (qstrcmp(QTest::currentDataTag(), "in-call") == 0) {
|
||||
// create a call back to us containing a file descriptor
|
||||
|
Loading…
Reference in New Issue
Block a user