QtDBus: don't detach in registerComplexDBusType()::Hash static destruction

The old code's use of ranged-for loop over a QHash would trigger said
QHash to detach. We don't require a detach here, so avoid this
unnecessary program shutdown slowdown using std::as_const().

Possibly-related: remove the pointless std::move() around QMetaType
passing - QMetaType is trivially copyable.

Amends 1697fbdf05ff643d617a9ba1614454926e86a3d9.

Pick-to: 6.7 6.5
Change-Id: I7b8d404e93ae4dde71a30e22e9e2f56a4b5354fb
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 167382beaad38fd7cbd9764abe76055544e61c20)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Marc Mutz 2024-07-01 11:33:53 +02:00 committed by Qt Cherry-pick Bot
parent a22ae96ab9
commit a2d858febf

View File

@ -116,8 +116,8 @@ static int registerComplexDBusType(const QByteArray &typeName)
{
~Hash()
{
for (QMetaType entry : *this)
QMetaType::unregisterMetaType(std::move(entry));
for (QMetaType entry : std::as_const(*this))
QMetaType::unregisterMetaType(entry);
}
} hash;
QMutexLocker lock(&mutex);