aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqmlpropertybinding.cpp
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2023-06-28 09:40:37 +0200
committerUlf Hermann <ulf.hermann@qt.io>2023-06-28 21:29:19 +0200
commit52fcaec65d0a13831b0b8c75957c58235d6fdcc4 (patch)
treef8704477bb6d2efea1b1a29a363f5f4f642a6124 /src/qml/qml/qqmlpropertybinding.cpp
parentc3ba7f88a1ab86f96c56f5745710a0a94046c366 (diff)
QQmlPropertyBinding: Do re-attach observer after handling undefined
As noted in the comments above, we need to restore the binding to its original state after resetting the property. This includes re-adding any observers. Pick-to: 6.2 6.5 6.6 Fixes: QTBUG-114874 Change-Id: I2113a59f1bed59753c77ca3e0b00fed4c0487584 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Diffstat (limited to 'src/qml/qml/qqmlpropertybinding.cpp')
-rw-r--r--src/qml/qml/qqmlpropertybinding.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/qml/qml/qqmlpropertybinding.cpp b/src/qml/qml/qqmlpropertybinding.cpp
index 6ec84d67d4..d1c44f205d 100644
--- a/src/qml/qml/qqmlpropertybinding.cpp
+++ b/src/qml/qml/qqmlpropertybinding.cpp
@@ -251,8 +251,10 @@ void QQmlPropertyBinding::handleUndefinedAssignment(QQmlEnginePrivate *ep, void
// reset might have changed observers (?), so refresh firstObserver
firstObserver = bindingDataPointer.firstObserver();
bindingData->d_ref() = reinterpret_cast<quintptr>(this) | QtPrivate::QPropertyBindingData::BindingBit;
- if (firstObserver)
+ if (firstObserver) {
bindingDataPointer.setObservers(firstObserver.ptr);
+ prependObserver(firstObserver);
+ }
} else {
QQmlError qmlError;
auto location = jsExpression()->sourceLocation();