From 32a5026f36018e124acd0794847d8fed3e27ed40 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Wed, 24 Jun 2015 01:41:19 +0200 Subject: [PATCH] QtDBus: replace some inefficient QLists with QVector QDBusIntrospection::Argument and the QPair are larger than a void*, so holding them in QLists is needlessly inefficient. Worse, the code could come to depend on the fragile property of (inefficient) QLists that references to elements therein never are invalidated. Fix by marking the types movable, if not already done, and holding them in QVector instead. Change-Id: I1cf88287cc3a1d87e1fcd5061ed8d6d19d2f0722 Reviewed-by: Alex Blasche Reviewed-by: Thiago Macieira --- src/dbus/qdbusconnection_p.h | 2 +- src/dbus/qdbusintrospection_p.h | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/dbus/qdbusconnection_p.h b/src/dbus/qdbusconnection_p.h index 5d8777c622..752ca9c37a 100644 --- a/src/dbus/qdbusconnection_p.h +++ b/src/dbus/qdbusconnection_p.h @@ -166,7 +166,7 @@ public: // typedefs typedef QMultiHash WatcherHash; typedef QHash TimeoutHash; - typedef QList > PendingTimeoutList; + typedef QVector > PendingTimeoutList; typedef QMultiHash SignalHookHash; typedef QHash MetaObjectHash; diff --git a/src/dbus/qdbusintrospection_p.h b/src/dbus/qdbusintrospection_p.h index ce3be00733..572a39b140 100644 --- a/src/dbus/qdbusintrospection_p.h +++ b/src/dbus/qdbusintrospection_p.h @@ -46,7 +46,7 @@ // #include -#include +#include #include #include #include @@ -71,7 +71,7 @@ public: // typedefs typedef QMap Annotations; - typedef QList Arguments; + typedef QVector Arguments; typedef QMultiMap Methods; typedef QMultiMap Signals; typedef QMap Properties; @@ -158,6 +158,7 @@ public: private: QDBusIntrospection(); }; +Q_DECLARE_TYPEINFO(QDBusIntrospection::Argument, Q_MOVABLE_TYPE); QT_END_NAMESPACE