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>
This commit is contained in:
parent
45254660d0
commit
ec4fd8832e
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue