diff --git a/src/corelib/kernel/qproperty.cpp b/src/corelib/kernel/qproperty.cpp index 5ad0fabd068..fbe582304b9 100644 --- a/src/corelib/kernel/qproperty.cpp +++ b/src/corelib/kernel/qproperty.cpp @@ -100,15 +100,15 @@ void QPropertyBindingPrivate::unlinkAndDeref() void QPropertyBindingPrivate::markDirtyAndNotifyObservers() { - if (dirty) - return; - dirty = true; if (eagerlyUpdating) { error = QPropertyBindingError(QPropertyBindingError::BindingLoop); if (isQQmlPropertyBinding) errorCallBack(this); return; } + if (dirty) + return; + dirty = true; eagerlyUpdating = true; QScopeGuard guard([&](){eagerlyUpdating = false;}); diff --git a/tests/auto/corelib/kernel/qproperty/tst_qproperty.cpp b/tests/auto/corelib/kernel/qproperty/tst_qproperty.cpp index 31ed610b099..630eee9e9cf 100644 --- a/tests/auto/corelib/kernel/qproperty/tst_qproperty.cpp +++ b/tests/auto/corelib/kernel/qproperty/tst_qproperty.cpp @@ -619,7 +619,8 @@ void tst_QProperty::changePropertyFromWithinChangeHandlerThroughDependency() resetPropertyOnChange = true; sourceProperty = 42; - QCOMPARE(property.value(), 100); + QVERIFY(property.value() == 100 || property.value() == 42); + QVERIFY(property.binding().error().type() == QPropertyBindingError::BindingLoop); // changing the property value inside the change handler won't result in the change // handler being called again. QCOMPARE(changeHandlerCallCount, 1); @@ -640,6 +641,7 @@ void tst_QProperty::changePropertyFromWithinChangeHandler2() property = 42; QCOMPARE(property.value(), 43); + QVERIFY(!property.hasBinding()); // setting the value in the change handler removed the binding } void tst_QProperty::settingPropertyValueDoesRemoveBinding()