summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/corelib/kernel/qvariant.cpp3
-rw-r--r--tests/auto/qvariant/tst_qvariant.cpp2
2 files changed, 4 insertions, 1 deletions
diff --git a/src/corelib/kernel/qvariant.cpp b/src/corelib/kernel/qvariant.cpp
index 95b2352..9a278bd 100644
--- a/src/corelib/kernel/qvariant.cpp
+++ b/src/corelib/kernel/qvariant.cpp
@@ -470,6 +470,9 @@ static bool compare(const QVariant::Private *a, const QVariant::Private *b)
if (typeNameLen > 0 && typeName[typeNameLen - 1] == '*')
return *static_cast<void *const *>(a_ptr) == *static_cast<void *const *>(b_ptr);
+ if (a->is_null && b->is_null)
+ return true;
+
return a_ptr == b_ptr;
}
diff --git a/tests/auto/qvariant/tst_qvariant.cpp b/tests/auto/qvariant/tst_qvariant.cpp
index b7e2c81..1fd6564 100644
--- a/tests/auto/qvariant/tst_qvariant.cpp
+++ b/tests/auto/qvariant/tst_qvariant.cpp
@@ -1969,7 +1969,7 @@ void tst_QVariant::operator_eq_eq_data()
QTest::newRow("HashSecondLarger") << QVariant(hash1) << QVariant(hash2) << false;
}
- QTest::newRow( "UserType" ) << QVariant(QVariant::UserType) << QVariant(QVariant::UserType) << false;
+ QTest::newRow( "UserType" ) << QVariant(QVariant::UserType) << QVariant(QVariant::UserType) << true;
QVariant mUserType(QVariant::UserType);
QTest::newRow( "Shared UserType" ) << mUserType << mUserType << true;
}