Skip to content

Commit 662c3c3

Browse files
committed
QQmlPropertyBinding: Re-fetch binding data after reset()
Pick-to: 6.2 6.5 6.6 Fixes: QTBUG-114430 Change-Id: I13773e7eba3603350b492c7649102a8131a9829c Reviewed-by: Fabian Kosmale <[email protected]>
1 parent 0bb0eee commit 662c3c3

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/qml/qml/qqmlpropertybinding.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,10 +230,17 @@ void QQmlPropertyBinding::handleUndefinedAssignment(QQmlEnginePrivate *ep, void
230230
setIsUndefined(true);
231231
//suspend binding evaluation state for reset and subsequent read
232232
auto state = QtPrivate::suspendCurrentBindingStatus();
233-
prop.reset();
233+
prop.reset(); // May re-allocate the bindingData
234234
QVariant currentValue = QVariant(prop.propertyMetaType(), propertyDataPtr);
235235
QtPrivate::restoreBindingStatus(state);
236236
writeBackCurrentValue(std::move(currentValue));
237+
238+
// Re-fetch binding data
239+
bindingData = storage->bindingData(propertyDataPtr);
240+
if (!bindingData)
241+
bindingData = bindingDataFromPropertyData(propertyDataPtr, propertyData->propType());
242+
bindingDataPointer = QPropertyBindingDataPointer {bindingData};
243+
237244
// reattach the binding (without causing a new notification)
238245
if (Q_UNLIKELY(bindingData->d() & QtPrivate::QPropertyBindingData::BindingBit)) {
239246
qCWarning(lcQQPropertyBinding) << "Resetting " << prop.name() << "due to the binding becoming undefined caused a new binding to be installed\n"

0 commit comments

Comments
 (0)