diff options
-rw-r--r-- | src/corelib/tools/qhash.h | 6 | ||||
-rw-r--r-- | tests/auto/corelib/tools/qhash/tst_qhash.cpp | 12 |
2 files changed, 15 insertions, 3 deletions
diff --git a/src/corelib/tools/qhash.h b/src/corelib/tools/qhash.h index f7f37de091..14e9cc452c 100644 --- a/src/corelib/tools/qhash.h +++ b/src/corelib/tools/qhash.h @@ -1312,12 +1312,12 @@ public: if (d->size != other.d->size) return false; for (auto it = other.d->begin(); it != other.d->end(); ++it) { - auto i = d->find(it.node()->key); - if (i == d->end()) + auto *n = d->findNode(it.node()->key); + if (!n) return false; Chain *e = it.node()->value; while (e) { - Chain *oe = i.node()->value; + Chain *oe = n->value; while (oe) { if (oe->value == e->value) break; 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" |