--- /dev/null
+import QtQuick 2.0
+
+QtObject {
+ function accessContextProperty() {
+ for (var i = 0; i < contextProp.stringProperty.length; ++i) ;
+ }
+
+ Component.onCompleted: {
+ for (var i = 0; i < 1000; ++i)
+ accessContextProperty();
+ // Shouldn't cause "Illegal invocation" error.
+ gc();
+ }
+}
void invokableObjectArg();
void invokableObjectRet();
void qtbug_20344();
+ void qtbug_22679();
void revisionErrors();
void revision();
delete object;
}
+void tst_qdeclarativeecmascript::qtbug_22679()
+{
+ MyQmlObject object;
+ object.setStringProperty(QLatin1String("Please work correctly"));
+ engine.rootContext()->setContextProperty("contextProp", &object);
+
+ QDeclarativeComponent component(&engine, TEST_FILE("qtbug_22679.qml"));
+ qRegisterMetaType<QList<QDeclarativeError> >("QList<QDeclarativeError>");
+ QSignalSpy warningsSpy(&engine, SIGNAL(warnings(QList<QDeclarativeError>)));
+
+ QObject *o = component.create();
+ QVERIFY(o != 0);
+ QCOMPARE(warningsSpy.count(), 0);
+ delete o;
+}
+
QTEST_MAIN(tst_qdeclarativeecmascript)
#include "tst_qdeclarativeecmascript.moc"