aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime
diff options
context:
space:
mode:
authorQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2020-02-21 01:00:10 +0100
committerUlf Hermann <ulf.hermann@qt.io>2020-02-21 09:00:37 +0100
commitf6808f89a8c17e046f53b0bb5ff36cd9e24e9772 (patch)
tree43df8901d99f1e134d7688bdf0d30d28c1679147 /src/qml/jsruntime
parente33e250080dbbb01015daafc8a79b569806d9467 (diff)
parent5054bb49a88a8ab76f586f79b6ef62a9142e6c83 (diff)
Merge remote-tracking branch 'origin/5.15' into dev
Conflicts: tests/auto/quick/qquickmousearea/BLACKLIST Change-Id: I3de2c6377d57f5f9204d2cfc688d50a7a0b4150c
Diffstat (limited to 'src/qml/jsruntime')
-rw-r--r--src/qml/jsruntime/qv4engine.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/qml/jsruntime/qv4engine.cpp b/src/qml/jsruntime/qv4engine.cpp
index a900e710c2..f1b20ce53b 100644
--- a/src/qml/jsruntime/qv4engine.cpp
+++ b/src/qml/jsruntime/qv4engine.cpp
@@ -1520,7 +1520,11 @@ static QVariant toVariant(QV4::ExecutionEngine *e, const QV4::Value &value, int
return retn;
#endif
if (typeHint != -1) {
- retn = QVariant(typeHint, QMetaType::create(typeHint));
+ // the QVariant constructor will create a copy, so we have manually
+ // destroy the value returned by QMetaType::create
+ auto temp = QMetaType::create(typeHint);
+ retn = QVariant(typeHint, temp);
+ QMetaType::destroy(typeHint, temp);
auto retnAsIterable = retn.value<QtMetaTypePrivate::QSequentialIterableImpl>();
if (retnAsIterable._iteratorCapabilities & QtMetaTypePrivate::ContainerIsAppendable) {
auto const length = a->getLength();
@@ -1533,8 +1537,8 @@ static QVariant toVariant(QV4::ExecutionEngine *e, const QV4::Value &value, int
if (!couldConvert) {
qWarning() << QLatin1String("Could not convert array value at position %1 from %2 to %3")
.arg(QString::number(i),
- QMetaType::typeName(originalType),
- QMetaType::typeName(retnAsIterable._metaType_id));
+ QString::fromUtf8(QMetaType::typeName(originalType)),
+ QString::fromUtf8(QMetaType::typeName(retnAsIterable._metaType_id)));
// create default constructed value
asVariant = QVariant(retnAsIterable._metaType_id, nullptr);
}