diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2020-11-17 12:13:55 +0100 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2020-11-17 19:48:11 +0100 |
commit | ec4fd8832e5bdecf4cf6dcb40660971f8d294e8a (patch) | |
tree | f04dbba6f9e95edb59f3ce99de03d8ee50f9b797 /src/qml/jsruntime | |
parent | 45254660d07c82399162931716e569737830802e (diff) |
V4: Deal with AOT-compiled functions returning QVariant
In this case we need to pass a pointer to the return variant itself, not
to its data.
Change-Id: I86e468f106f29e1f1be8adee9882d465fd6da533
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/qml/jsruntime')
-rw-r--r-- | src/qml/jsruntime/qv4vme_moth.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/qml/jsruntime/qv4vme_moth.cpp b/src/qml/jsruntime/qv4vme_moth.cpp index 5bb82aeadf..55c7759716 100644 --- a/src/qml/jsruntime/qv4vme_moth.cpp +++ b/src/qml/jsruntime/qv4vme_moth.cpp @@ -463,8 +463,17 @@ ReturnedValue VME::exec(CppStackFrame *frame, ExecutionEngine *engine) Scope scope(engine); Scoped<QmlContext> qmlContext(scope, engine->qmlContext()); - QVariant resultVariant(function->aotFunction->returnType, nullptr); - function->aotFunction->functionPtr(qmlContext->qmlContext()->asQQmlContext(), qmlContext->qmlScope(), resultVariant.data()); + QVariant resultVariant; + if (function->aotFunction->returnType.id() == QMetaType::QVariant) { + function->aotFunction->functionPtr( + qmlContext->qmlContext()->asQQmlContext(), qmlContext->qmlScope(), + &resultVariant); + } else { + resultVariant = QVariant(function->aotFunction->returnType, nullptr); + function->aotFunction->functionPtr( + qmlContext->qmlContext()->asQQmlContext(), qmlContext->qmlScope(), + resultVariant.data()); + } result = engine->fromVariant(resultVariant); } else { // interpreter |