{
QQmlData *ddata = static_cast<QQmlData *>(QObjectPrivate::get(o)->declarativeData);
+ index &= 0xFFFFFF; // To handle value types
+
return ddata && (ddata->bindingBitsSize > index) &&
(ddata->bindingBits[index / 32] & (1 << (index % 32)));
}
static void removeBindingOnProperty(QObject *o, int index)
{
- QQmlAbstractBinding *binding = QQmlPropertyPrivate::setBinding(o, index, -1, 0);
+ int coreIndex = index & 0xFFFFFF;
+ int valueTypeIndex = index & 0xFF000000;
+ if (!valueTypeIndex) valueTypeIndex = -1;
+
+ QQmlAbstractBinding *binding = QQmlPropertyPrivate::setBinding(o, coreIndex, valueTypeIndex, 0);
if (binding) binding->destroy();
}
Q_ASSERT(bind->propertyIndex() == QDPP::bindingIndex(instr.property));
Q_ASSERT(bind->object() == target);
+ CLEAN_PROPERTY(target, QDPP::bindingIndex(instr.property));
+
bind->addToObject();
}
QML_END_INSTR(StoreBinding)
Q_ASSERT(binding->propertyIndex() == (property & 0xFF00FFFF));
Q_ASSERT(binding->object() == target);
+ CLEAN_PROPERTY(target, property & 0xFF00FFFF);
+
binding->addToObject();
QML_END_INSTR(StoreV4Binding)
Q_ASSERT(binding->propertyIndex() == QDPP::bindingIndex(instr.property));
Q_ASSERT(binding->object() == target);
+ CLEAN_PROPERTY(target, QDPP::bindingIndex(instr.property));
+
binding->addToObject();
}
}
--- /dev/null
+import QtQuick 2.0
+
+QtObject {
+ property int foo1: 100
+ property int foo2: 100
+ property int foo3: { return 100; }
+ property int foo4: { return 100; }
+
+ property string bar1: 'Hello'
+ property string bar2: 'Hello'
+ property string bar3: { return 'Hello'; }
+ property string bar4: { return 'Hello'; }
+}
--- /dev/null
+import QtQuick 2.0
+
+OuterObject {
+ property bool success: false
+
+ inner.foo1: 200
+ inner.foo2: { return 200; }
+ inner.foo3: 200
+ inner.foo4: { return 200; }
+
+ inner.bar1: 'Goodbye'
+ inner.bar2: { return 'Goodbye' }
+ inner.bar3: 'Goodbye'
+ inner.bar4: { return 'Goodbye' }
+
+ Component.onCompleted: {
+ success = (inner.foo1 == 200 &&
+ inner.foo2 == 200 &&
+ inner.foo3 == 200 &&
+ inner.foo4 == 200 &&
+ inner.bar1 == 'Goodbye' &&
+ inner.bar2 == 'Goodbye' &&
+ inner.bar3 == 'Goodbye' &&
+ inner.bar4 == 'Goodbye');
+ }
+}
void switchStatement();
void withStatement();
void tryStatement();
+ void replaceBinding();
private:
static void propertyVarWeakRefCallback(v8::Persistent<v8::Value> object, void* parameter);
delete object;
}
+// QTBUG-23138
+void tst_qqmlecmascript::replaceBinding()
+{
+ QQmlEngine engine;
+ QQmlComponent c(&engine, testFileUrl("replaceBinding.qml"));
+ QObject *obj = c.create();
+ QVERIFY(obj != 0);
+
+ QVERIFY(obj->property("success").toBool());
+ delete obj;
+}
+
QTEST_MAIN(tst_qqmlecmascript)
#include "tst_qqmlecmascript.moc"