aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4engine.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/qml/jsruntime/qv4engine.cpp')
-rw-r--r--src/qml/jsruntime/qv4engine.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/qml/jsruntime/qv4engine.cpp b/src/qml/jsruntime/qv4engine.cpp
index a900e710c2..aea81b1e07 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();