From e023a338c4f30e43f4b2ae4a916e4051123d41dd Mon Sep 17 00:00:00 2001 From: Erik Verbruggen Date: Thu, 14 Jun 2018 12:25:44 +0200 Subject: 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 Reviewed-by: Simon Hausmann --- src/qml/qml/v8/qqmlbuiltinfunctions.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src') 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); -- cgit v1.2.3