diff options
author | Simon Hausmann <simon.hausmann@digia.com> | 2013-07-01 08:48:41 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-07-03 13:22:25 +0200 |
commit | 06eaeb0ac8d861cf3e60b11a8fbbabdeef1d6759 (patch) | |
tree | 825fb27485c376d0b83e8dfbcd20c852f2dd525c /src/qml/qml/qqmlboundsignal_p.h | |
parent | b30657647a7f816a2945302b3569b882d7ac6b72 (diff) |
Get rid of the signal expression rewriter
This replaces the entire rewriter with more or less:
expressionToEval = "(function(<named params here>) { " + expr + " } )"
This also fixes crashes at run-time when the signal rewriter was
executed from the loader thread and tried to use a v4 identifier
hash with the same engine that's also in the main thread.
Change-Id: Ib1e4927d330706a593411fbff64ed3da1e23d0e0
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src/qml/qml/qqmlboundsignal_p.h')
-rw-r--r-- | src/qml/qml/qqmlboundsignal_p.h | 18 |
1 files changed, 5 insertions, 13 deletions
diff --git a/src/qml/qml/qqmlboundsignal_p.h b/src/qml/qml/qqmlboundsignal_p.h index 33fa5be0a9..7d3adb17b1 100644 --- a/src/qml/qml/qqmlboundsignal_p.h +++ b/src/qml/qml/qqmlboundsignal_p.h @@ -70,18 +70,15 @@ class Q_QML_PRIVATE_EXPORT QQmlBoundSignalExpression : public QQmlAbstractExpres { public: QQmlBoundSignalExpression(QObject *target, int index, - QQmlContextData *ctxt, QObject *scope, const QByteArray &expression, - bool isRewritten, const QString &fileName, quint16 line, quint16 column); - QQmlBoundSignalExpression(QObject *target, int index, QQmlContextData *ctxt, QObject *scope, const QString &expression, - bool isRewritten, const QString &fileName, quint16 line, quint16 column); + const QString &fileName, quint16 line, quint16 column, + const QString &handlerName = QString()); + // "inherited" from QQmlJavaScriptExpression. static QString expressionIdentifier(QQmlJavaScriptExpression *); static void expressionChanged(QQmlJavaScriptExpression *); - void setParameterCountForJS(int count) { m_parameterCountForJS = count; } - // evaluation of a bound signal expression doesn't return any value void evaluate(void **a); @@ -97,27 +94,22 @@ private: ~QQmlBoundSignalExpression(); void init(QQmlContextData *ctxt, QObject *scope); - bool hasParameterInfo() const { return m_parameterCountForJS > 0; } QV4::PersistentValue m_v8qmlscope; QV4::PersistentValue m_v8function; - //either expressionUtf8 or expression will be used (but not both). - //once m_v8function is valid, we clear both expressions, and + QString m_handlerName; + //once m_v8function is valid, we clear expression and //extract it from m_v8function if needed. - QByteArray m_expressionUtf8; QString m_expression; //only used when expression needs to be rewritten QString m_fileName; quint16 m_line; quint16 m_column; - int m_parameterCountForJS; - QObject *m_target; int m_index; bool m_expressionFunctionValid:1; - bool m_expressionFunctionRewritten:1; bool m_invalidParameterName:1; }; |