diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2018-03-16 14:51:15 +0100 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@qt.io> | 2018-03-17 10:29:44 +0000 |
commit | 61447075954aab99b3abc9c78294e5966ae3b6ce (patch) | |
tree | 68192e06f529b2f2613d2541ea6063fa6fcba8ec /src/qml | |
parent | 80b5f8c2f448be574e731e5d371c38b84578f5c3 (diff) |
Pass "this" object when evaluating debug jobs
We have to explicitly specify the "this" object on QV4::Function::call,
otherwise it will assume undefined or the QML global object.
Task-number: QTBUG-66942
Change-Id: I1af7742b4fee1b49e9760a413834daf3edb15d74
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml')
-rw-r--r-- | src/qml/jsruntime/qv4script.cpp | 7 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4script_p.h | 2 |
2 files changed, 5 insertions, 4 deletions
diff --git a/src/qml/jsruntime/qv4script.cpp b/src/qml/jsruntime/qv4script.cpp index bb6608bec0..267c93952d 100644 --- a/src/qml/jsruntime/qv4script.cpp +++ b/src/qml/jsruntime/qv4script.cpp @@ -136,7 +136,7 @@ void Script::parse() } } -ReturnedValue Script::run() +ReturnedValue Script::run(const QV4::Value *thisObject) { if (!parsed) parse(); @@ -149,10 +149,11 @@ ReturnedValue Script::run() if (qmlContext.isUndefined()) { TemporaryAssignment<Function*> savedGlobalCode(engine->globalCode, vmFunction); - return vmFunction->call(engine->globalObject, nullptr, 0, context); + return vmFunction->call(thisObject ? thisObject : engine->globalObject, nullptr, 0, + context); } else { Scoped<QmlContext> qml(valueScope, qmlContext.value()); - return vmFunction->call(nullptr, nullptr, 0, qml); + return vmFunction->call(thisObject, nullptr, 0, qml); } } diff --git a/src/qml/jsruntime/qv4script_p.h b/src/qml/jsruntime/qv4script_p.h index 24291b9aa6..cb03c6b064 100644 --- a/src/qml/jsruntime/qv4script_p.h +++ b/src/qml/jsruntime/qv4script_p.h @@ -93,7 +93,7 @@ struct Q_QML_EXPORT Script { bool parseAsBinding; void parse(); - ReturnedValue run(); + ReturnedValue run(const QV4::Value *thisObject = nullptr); Function *function(); |