From 426b5fbce437128a10055ebfdc4431e6a2ab312c Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Tue, 2 May 2023 09:30:00 +0200 Subject: [PATCH] D-Bus: use move() on QVariants in writeProperty() The writeProperty() function takes the QVariant value by value, so we can move from it, using the newly-added QMetaProperty::write() rvalue overload. As a drive-by, replace a copy-assignment with a move. Task-number: QTBUG-112762 Change-Id: I6d5361830b4874fa846be513882ede4ab881246b Reviewed-by: Giuseppe D'Angelo Reviewed-by: Fabian Kosmale --- src/dbus/qdbusinternalfilters.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/dbus/qdbusinternalfilters.cpp b/src/dbus/qdbusinternalfilters.cpp index d963903dc64..57ae0326e75 100644 --- a/src/dbus/qdbusinternalfilters.cpp +++ b/src/dbus/qdbusinternalfilters.cpp @@ -332,14 +332,14 @@ static int writeProperty(QObject *obj, const QByteArray &property_name, QVariant return PropertyWriteFailed; } - value = other; + value = std::move(other); } if (mp.metaType() == QMetaType::fromType()) value = QVariant::fromValue(QDBusVariant(value)); // the property type here should match - return mp.write(obj, value) ? PropertyWriteSuccess : PropertyWriteFailed; + return mp.write(obj, std::move(value)) ? PropertyWriteSuccess : PropertyWriteFailed; } QDBusMessage qDBusPropertySet(const QDBusConnectionPrivate::ObjectTreeNode &node,