diff options
-rw-r--r-- | src/qml/qml/qqmljavascriptexpression.cpp | 9 | ||||
-rw-r--r-- | src/qml/qml/qqmljavascriptexpression_p.h | 1 |
2 files changed, 9 insertions, 1 deletions
diff --git a/src/qml/qml/qqmljavascriptexpression.cpp b/src/qml/qml/qqmljavascriptexpression.cpp index 96a9f5b6b1..a9e309396e 100644 --- a/src/qml/qml/qqmljavascriptexpression.cpp +++ b/src/qml/qml/qqmljavascriptexpression.cpp @@ -142,6 +142,13 @@ QQmlSourceLocation QQmlJavaScriptExpression::sourceLocation() const return QQmlSourceLocation(); } +void QQmlJavaScriptExpression::setSourceLocation(const QQmlSourceLocation &location) +{ + if (m_sourceLocation) + delete m_sourceLocation; + m_sourceLocation = new QQmlSourceLocation(location); +} + void QQmlJavaScriptExpression::setContext(QQmlContextData *context) { if (m_prevExpression) { @@ -457,7 +464,7 @@ void QQmlJavaScriptExpression::setFunctionObject(const QV4::FunctionObject *o) m_v4Function = o->d()->function; if (o->isBinding()) { const QV4::QQmlBindingFunction *b = static_cast<const QV4::QQmlBindingFunction *>(o); - m_sourceLocation = new QQmlSourceLocation(*b->d()->bindingLocation); + setSourceLocation(*b->d()->bindingLocation); m_v4Function = b->d()->originalFunction->function; } Q_ASSERT(m_v4Function); diff --git a/src/qml/qml/qqmljavascriptexpression_p.h b/src/qml/qml/qqmljavascriptexpression_p.h index 8a230efeeb..4d88c987b8 100644 --- a/src/qml/qml/qqmljavascriptexpression_p.h +++ b/src/qml/qml/qqmljavascriptexpression_p.h @@ -114,6 +114,7 @@ public: inline void setScopeObject(QObject *v); QQmlSourceLocation sourceLocation() const; + void setSourceLocation(const QQmlSourceLocation &location); bool isValid() const { return context() != 0; } |