aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqmljavascriptexpression.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/qml/qml/qqmljavascriptexpression.cpp')
-rw-r--r--src/qml/qml/qqmljavascriptexpression.cpp9
1 files changed, 8 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);