summaryrefslogtreecommitdiffstats
path: root/src/declarative/qml/qmlobjectscriptclass.cpp
diff options
context:
space:
mode:
authorAaron Kennedy <aaron.kennedy@nokia.com>2010-02-11 01:21:01 (GMT)
committerAaron Kennedy <aaron.kennedy@nokia.com>2010-02-11 01:23:45 (GMT)
commit87652f1bfd5a7cefc90ffe1aba23c179a75cfd0d (patch)
tree49d0b6caec9d6bd7fce153184fd1f6c3fdd9e700 /src/declarative/qml/qmlobjectscriptclass.cpp
parentddcfc5cd767001aaeeb532ac8f7b10ad9cf891d8 (diff)
downloadQt-87652f1bfd5a7cefc90ffe1aba23c179a75cfd0d.zip
Qt-87652f1bfd5a7cefc90ffe1aba23c179a75cfd0d.tar.gz
Qt-87652f1bfd5a7cefc90ffe1aba23c179a75cfd0d.tar.bz2
Fix tst_qmlecmascript::callQtInvokables
The assert in qmlobjectscriptclass.cpp is valid when the call is running in a correctly created QML environment, but not valid for the test case which bypasses QML.
Diffstat (limited to 'src/declarative/qml/qmlobjectscriptclass.cpp')
-rw-r--r--src/declarative/qml/qmlobjectscriptclass.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/declarative/qml/qmlobjectscriptclass.cpp b/src/declarative/qml/qmlobjectscriptclass.cpp
index 7bbb7df..2823496 100644
--- a/src/declarative/qml/qmlobjectscriptclass.cpp
+++ b/src/declarative/qml/qmlobjectscriptclass.cpp
@@ -153,10 +153,11 @@ QmlObjectScriptClass::queryProperty(QObject *obj, const Identifier &name,
if (!evalContext && context()) {
// Global object, QScriptContext activation object, QmlContext object
QScriptValue scopeNode = scopeChainValue(context(), -3);
- Q_ASSERT(scopeNode.isValid());
- Q_ASSERT(scriptClass(scopeNode) == enginePrivate->contextClass);
+ if (scopeNode.isValid()) {
+ Q_ASSERT(scriptClass(scopeNode) == enginePrivate->contextClass);
- evalContext = enginePrivate->contextClass->contextFromValue(scopeNode);
+ evalContext = enginePrivate->contextClass->contextFromValue(scopeNode);
+ }
}
if (evalContext) {
@@ -332,10 +333,11 @@ void QmlObjectScriptClass::setProperty(QObject *obj,
if (!evalContext && context()) {
// Global object, QScriptContext activation object, QmlContext object
QScriptValue scopeNode = scopeChainValue(context(), -3);
- Q_ASSERT(scopeNode.isValid());
- Q_ASSERT(scriptClass(scopeNode) == enginePriv->contextClass);
+ if (scopeNode.isValid()) {
+ Q_ASSERT(scriptClass(scopeNode) == enginePriv->contextClass);
- evalContext = enginePriv->contextClass->contextFromValue(scopeNode);
+ evalContext = enginePriv->contextClass->contextFromValue(scopeNode);
+ }
}
QmlAbstractBinding *delBinding = QmlMetaPropertyPrivate::setBinding(obj, *lastData, 0);