diff options
author | Andreas Buhr <andreas.buhr@qt.io> | 2021-11-11 11:37:22 +0100 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2021-11-11 22:13:59 +0000 |
commit | 682b19a8c7cd2bba669064f9e99d1acfe835326f (patch) | |
tree | 5aed64be54e3ed8866546e20e826848cfa2553bf /tests/auto | |
parent | 741f15fa6d0b8bf45eef141493cc030ea6056ec2 (diff) |
Fix QMultiHash::operator== crash
QMultiHash::operator== crashes when comparing two unequal objects.
This patch fixes it.
Fixes: QTBUG-98265
Change-Id: Ibf9fef3372a2b4581843be5f25e65cc9a55ef64d
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
(cherry picked from commit 838edd9c48284b97dfc22cf3644bb082035a9a93)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'tests/auto')
-rw-r--r-- | tests/auto/corelib/tools/qhash/tst_qhash.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/auto/corelib/tools/qhash/tst_qhash.cpp b/tests/auto/corelib/tools/qhash/tst_qhash.cpp index 576a1c6107..7e297c0119 100644 --- a/tests/auto/corelib/tools/qhash/tst_qhash.cpp +++ b/tests/auto/corelib/tools/qhash/tst_qhash.cpp @@ -95,6 +95,8 @@ private slots: void fineTuningInEmptyHash(); void reserveShared(); + + void QTBUG98265(); }; struct IdentityTracker { @@ -1742,6 +1744,7 @@ void tst_QHash::qmultihash_specific() map2.insert(48, 3); QCOMPARE(map1.count(), map2.count()); QVERIFY(map1.remove(42,5)); + QVERIFY(map1 != map2); QVERIFY(map2.remove(42,5)); QVERIFY(map1 == map2); @@ -2615,5 +2618,14 @@ void tst_QHash::reserveShared() QCOMPARE(hash.capacity(), oldCap); } +void tst_QHash::QTBUG98265() +{ + QMultiHash<QUuid, QByteArray> a; + QMultiHash<QUuid, QByteArray> b; + a.insert(QUuid("3e0dfb4d-90eb-43a4-bd54-88f5b69832c1"), QByteArray()); + b.insert(QUuid("1b710ada-3dd7-432e-b7c8-e852e59f46a0"), QByteArray()); + + QVERIFY(a != b); +} QTEST_APPLESS_MAIN(tst_QHash) #include "tst_qhash.moc" |