v8::Handle<v8::Function> QQmlVMEMetaObject::method(int index)
{
+ if (!ctxt || !ctxt->isValid()) {
+ qWarning("QQmlVMEMetaObject: Internal error - attempted to evaluate a function in an invalid context");
+ return v8::Handle<v8::Function>();
+ }
+
if (!v8methods)
v8methods = new v8::Persistent<v8::Function>[metaData->methodCount];
--- /dev/null
+import QtQuick 2.0
+
+Item {
+ function doSomething() { if (333 == 666) console.log('doSomething') }
+}
--- /dev/null
+import QtQuick 2.0
+
+Item {
+ property int count: 0
+ property bool hasValidParent: parent && parent.children.length != 0
+
+ onHasValidParentChanged: {
+ if (++count > 1) parent.doSomething()
+ }
+}
--- /dev/null
+import QtQuick 2.0
+
+Rectangle {
+ id: root
+
+ Component.onCompleted: {
+ var i = containerComponent.createObject(root);
+ contentComponent.createObject(i);
+ i.destroy()
+ }
+
+ property Component containerComponent: ContainerComponent {}
+ property Component contentComponent: ContentComponent {}
+}
void refreshExpressionsRootContext();
void qtbug_22535();
+ void evalAfterInvalidate();
+
private:
QQmlEngine engine;
};
delete o;
}
+void tst_qqmlcontext::evalAfterInvalidate()
+{
+ QQmlEngine engine;
+ QQmlComponent component(&engine, testFileUrl("evalAfterInvalidate.qml"));
+ QScopedPointer<QObject> o(component.create());
+
+ QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete);
+ QCoreApplication::processEvents();
+}
+
QTEST_MAIN(tst_qqmlcontext)
#include "tst_qqmlcontext.moc"