summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorErik Verbruggen <erik.verbruggen@qt.io>2018-06-14 12:25:44 +0200
committerErik Verbruggen <erik.verbruggen@qt.io>2018-06-21 08:50:45 +0000
commite023a338c4f30e43f4b2ae4a916e4051123d41dd (patch)
tree86c280fabab3d0305be4874ed7fbc5bed42209de /src
parentfceb04cf29764c815fb539d3d62ed26edcb78448 (diff)
Fix crash in binding setup during async load from a Loader
Change 91ac4a8d099d10fdfd5aa631da02727b7917d85f removed the source location from QQmlBindingFunction, because it can be retrieved from the QV4::Function in the QV4::CppStackFrame. However, if a binding is initialized as part of an asynchronous load from a Loader component, there might not be a valid function pointer in that frame. In this specific case, we fall back to the source location of the binding function. Task-number: QTBUG-68738 Change-Id: I2d3f17e4cb82be1e70a54cb66f9cf9c17f541f95 Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/qml/qml/v8/qqmlbuiltinfunctions.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/qml/qml/v8/qqmlbuiltinfunctions.cpp b/src/qml/qml/v8/qqmlbuiltinfunctions.cpp
index 221754a29a..f04bee7f19 100644
--- a/src/qml/qml/v8/qqmlbuiltinfunctions.cpp
+++ b/src/qml/qml/v8/qqmlbuiltinfunctions.cpp
@@ -1355,7 +1355,10 @@ void Heap::QQmlBindingFunction::init(const QV4::FunctionObject *bindingFunction)
QQmlSourceLocation QQmlBindingFunction::currentLocation() const
{
QV4::CppStackFrame *frame = engine()->currentStackFrame;
- return QQmlSourceLocation(frame->source(), frame->lineNumber(), 0);
+ if (frame->v4Function) // synchronous loading:
+ return QQmlSourceLocation(frame->source(), frame->lineNumber(), 0);
+ else // async loading:
+ return bindingFunction()->function->sourceLocation();
}
DEFINE_OBJECT_VTABLE(QQmlBindingFunction);