diff options
author | Lars Knoll <lars.knoll@qt.io> | 2016-12-02 12:47:28 +0100 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2016-12-09 14:01:38 +0000 |
commit | f1dca03794f8db353655d44e742a2960f1f69070 (patch) | |
tree | 3741f420b0652c5786a51cc952f04e402fb03a25 /src | |
parent | b4f4caababf3c561dbf61a4c75450598cb424ca0 (diff) |
Don't create a QML function is the signal parameters are invalid
Moves the error checking to where the error occurs.
Change-Id: I2590d3a9d41f41c16d19e4f5883b78a8b28a883c
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/qml/jsruntime/qv4functionobject.cpp | 4 | ||||
-rw-r--r-- | src/qml/qml/qqmlboundsignal.cpp | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/src/qml/jsruntime/qv4functionobject.cpp b/src/qml/jsruntime/qv4functionobject.cpp index 172b29e88b..c65882ed7a 100644 --- a/src/qml/jsruntime/qv4functionobject.cpp +++ b/src/qml/jsruntime/qv4functionobject.cpp @@ -208,8 +208,10 @@ Heap::FunctionObject *FunctionObject::createQmlFunction(QQmlContextData *qmlCont QV4::Scoped<QmlContext> wrapperContext(valueScope, QmlContext::create(global, qmlContext, scopeObject)); if (!signalParameters.isEmpty()) { - if (error) + if (error) { QQmlPropertyCache::signalParameterStringForJS(engine, signalParameters, error); + return 0; + } runtimeFunction->updateInternalClass(engine, signalParameters); } diff --git a/src/qml/qml/qqmlboundsignal.cpp b/src/qml/qml/qqmlboundsignal.cpp index 18d1e6bb4a..91b3f89825 100644 --- a/src/qml/qml/qqmlboundsignal.cpp +++ b/src/qml/qml/qqmlboundsignal.cpp @@ -122,10 +122,8 @@ QQmlBoundSignalExpression::QQmlBoundSignalExpression(QObject *target, int index, QString error; QV4::ExecutionEngine *engine = QQmlEnginePrivate::getV4Engine(ctxt->engine); m_function.set(engine, QV4::FunctionObject::createQmlFunction(ctxt, scope, runtimeFunction, signal.parameterNames(), &error)); - if (!error.isEmpty()) { + if (!error.isEmpty()) qmlInfo(scopeObject()) << error; - m_function.clear(); - } } void QQmlBoundSignalExpression::init(QQmlContextData *ctxt, QObject *scope) |