summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/kernel
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@qt.io>2020-03-23 21:30:21 +0100
committerSimon Hausmann <simon.hausmann@qt.io>2020-03-27 13:29:47 +0100
commitf3ce9e9332820a8b5084fb4d75994e8eb19ddfd3 (patch)
tree92efbcf85b11d4eb30d91e553b68180551943e9e /tests/auto/corelib/kernel
parent96de3e26dbd14be6e43db7116c3ce815f9fc9d4b (diff)
Make QPropertyBindingPrivate accessible to QtQml
QtQml needs the private just for one detail which nobody else should need it for: Tracking additional dependencies and marking the binding as dirty. Exporting the private requires hiding some variables and providing accessors, to compile with MSVC - including the removal of QVarLengthArray usage. Upside: The binding structure shrinks by 8 bytes and the encapsulation makes it a little easier to change things without breaking declarative, ... in the unlikely event ;-) Also remove setDirty() from the public API as it's not needed by QtQml and using it is dangerous, because it means that there's a risk of somebody keeping a reference (count) to the untyped binding from within the binding closure, which introduces a memory leak. Change-Id: I43bd56f4bdf218efb54fa23e2d627ad3acfafeb5 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'tests/auto/corelib/kernel')
-rw-r--r--tests/auto/corelib/kernel/qproperty/tst_qproperty.cpp8
1 files changed, 3 insertions, 5 deletions
diff --git a/tests/auto/corelib/kernel/qproperty/tst_qproperty.cpp b/tests/auto/corelib/kernel/qproperty/tst_qproperty.cpp
index 942865f3a3..d4c5741814 100644
--- a/tests/auto/corelib/kernel/qproperty/tst_qproperty.cpp
+++ b/tests/auto/corelib/kernel/qproperty/tst_qproperty.cpp
@@ -220,13 +220,11 @@ void tst_QProperty::avoidDependencyAllocationAfterFirstEval()
QCOMPARE(propWithBinding.value(), int(11));
QVERIFY(QPropertyBasePointer::get(propWithBinding).bindingPtr());
- QCOMPARE(QPropertyBasePointer::get(propWithBinding).bindingPtr()->dependencyObservers.size(), 2);
- QVERIFY(QPropertyBasePointer::get(propWithBinding).bindingPtr()->dependencyObservers.capacity() >= 2);
+ QCOMPARE(QPropertyBasePointer::get(propWithBinding).bindingPtr()->dependencyObserverCount, 2);
firstDependency = 100;
QCOMPARE(propWithBinding.value(), int(110));
- QCOMPARE(QPropertyBasePointer::get(propWithBinding).bindingPtr()->dependencyObservers.size(), 2);
- QVERIFY(QPropertyBasePointer::get(propWithBinding).bindingPtr()->dependencyObservers.capacity() >= 2);
+ QCOMPARE(QPropertyBasePointer::get(propWithBinding).bindingPtr()->dependencyObserverCount, 2);
}
void tst_QProperty::propertyArrays()
@@ -493,7 +491,7 @@ void tst_QProperty::bindingSourceLocation()
#if defined(QT_PROPERTY_COLLECT_BINDING_LOCATION)
auto bindingLine = std::experimental::source_location::current().line() + 1;
auto binding = Qt::makePropertyBinding([]() { return 42; });
- QCOMPARE(QPropertyBindingPrivate::get(binding)->location.line, bindingLine);
+ QCOMPARE(QPropertyBindingPrivate::get(binding)->sourceLocation().line, bindingLine);
#else
QSKIP("Skipping this in the light of missing binding source location support");
#endif