summaryrefslogtreecommitdiffstats
path: root/tests/auto/qvariant
diff options
context:
space:
mode:
authorOlivier Goffart <ogoffart@trolltech.com>2009-08-20 18:25:32 +0200
committerOlivier Goffart <ogoffart@trolltech.com>2009-08-21 13:37:21 +0200
commitf5f89d34fa98600a95c4b1b8b62bd794ab8c8e3b (patch)
tree97a25ac3377c7e2dc0aa43e38daac81c59b7aa44 /tests/auto/qvariant
parent4aa4111864df9e8a7917b021d6e31214e8c7a0bd (diff)
Optimize contrcuction of variant of type pointer.
Constructing a variant of a pointer type was previously quite slow: QVariant had no information it was a pointer. It had to create a QVariant::PrivateShared, ask the QMetaType for a constructor (slow as it involve locking mutextes) and allocate a pointer. By detecting a pointer in qVariantFromValue, we can store the pointer value dirrectly in the Variant union. We then avoid 2 allocations, and the expensive locking in QMetaType::construct Reviewed-by: Thierry
Diffstat (limited to 'tests/auto/qvariant')
-rw-r--r--tests/auto/qvariant/tst_qvariant.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/tests/auto/qvariant/tst_qvariant.cpp b/tests/auto/qvariant/tst_qvariant.cpp
index 709cba9c75..1722ad39c8 100644
--- a/tests/auto/qvariant/tst_qvariant.cpp
+++ b/tests/auto/qvariant/tst_qvariant.cpp
@@ -2747,6 +2747,7 @@ void tst_QVariant::dataStar() const
v2 = qVariantFromValue(p1);
QVERIFY(v1 == v2);
+ delete p1;
}
void tst_QVariant::canConvertQStringList() const