summaryrefslogtreecommitdiffstats
path: root/src/corelib/kernel/qproperty.cpp
diff options
context:
space:
mode:
authorFabian Kosmale <fabian.kosmale@qt.io>2021-07-07 13:14:34 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2021-07-07 15:59:54 +0000
commit18036456de6dc847b88c239ef170358ac90d5b07 (patch)
tree7416bf33d98ba40c9ce04e83a6ee210660dcd42d /src/corelib/kernel/qproperty.cpp
parent31ba3d32231352432b7f442577ccd9f58a58a651 (diff)
QProperty: Downgrade assert in noSelfDependencies to warning
We call evaluateRecursive_inline in setBinding, which in turns runs the noSelfDependecies check. However, creating a binding resuting in a binding loop must not crash, but instead result in the binding entering an error state. To prevent a crash caused by the assert in debug builds of Qt, we replace the assert with a warning for now. A better approach in the future would be to ensure that we only run the check in cases where we are sure that a self-dependency is really a fatal error. Change-Id: I58158864ed81fa907132a4e7d6667c9b529e7e64 Reviewed-by: Maximilian Goldstein <max.goldstein@qt.io> (cherry picked from commit fd308819891fdc3c4296050193e97f5d9259501f) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src/corelib/kernel/qproperty.cpp')
-rw-r--r--src/corelib/kernel/qproperty.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/corelib/kernel/qproperty.cpp b/src/corelib/kernel/qproperty.cpp
index 965939a1fc..f1c8adb8a0 100644
--- a/src/corelib/kernel/qproperty.cpp
+++ b/src/corelib/kernel/qproperty.cpp
@@ -744,7 +744,10 @@ void QPropertyObserverPointer::noSelfDependencies(QPropertyBindingPrivate *bindi
// See also comment in notify()
while (observer) {
if (QPropertyObserver::ObserverTag(observer->next.tag()) == QPropertyObserver::ObserverNotifiesBinding)
- Q_ASSERT(observer->binding != binding);
+ if (observer->binding == binding) {
+ qCritical("Property depends on itself!");
+ break;
+ }
observer = observer->next.data();
}