telepathy-qt: Fix hash calculation of QList<ChannelClassSpec>

Alexandr Akulich kaffeine at kemper.freedesktop.org
Sat Apr 23 08:33:21 UTC 2016


Module: telepathy-qt
Branch: master
Commit: c693cd2f5ba3a83ddb40d166be74de4bd10c829b
URL:    http://cgit.freedesktop.org/telepathy/telepathy-qt/commit/?id=c693cd2f5ba3a83ddb40d166be74de4bd10c829b

Author: Niels Ole Salscheider <niels_ole at salscheider-online.de>
Date:   Sun Feb 28 16:04:28 2016 +0100

Fix hash calculation of QList<ChannelClassSpec>

Without this, the calculated hash for a QList<ChannelClassSpec> does
not match the hash of a ChannelClassSpecList (on Qt 5.6 at least).

---

 TelepathyQt/channel-class-spec.h | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/TelepathyQt/channel-class-spec.h b/TelepathyQt/channel-class-spec.h
index 90c6a24..9d35900 100644
--- a/TelepathyQt/channel-class-spec.h
+++ b/TelepathyQt/channel-class-spec.h
@@ -313,6 +313,13 @@ inline uint qHash(const ChannelClassSpecList &specList)
     return qHash(uniqueSet);
 }
 
+inline uint qHash(const QList<ChannelClassSpec> &specList)
+{
+    // Make it unique by converting to QSet
+    QSet<ChannelClassSpec> uniqueSet = specList.toSet();
+    return qHash(uniqueSet);
+}
+
 } // Tp
 
 Q_DECLARE_METATYPE(Tp::ChannelClassSpec);



More information about the telepathy-commits mailing list